Package net.handle.util
Class AsciiJsonWriter
- java.lang.Object
-
- java.io.Writer
-
- net.handle.util.AsciiJsonWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.Appendable
,java.lang.AutoCloseable
public class AsciiJsonWriter extends java.io.Writer
Class which wraps anotherWriter
in order to write only ASCII. Non-ASCII characters are JSON-encoded as \u####. Suggested for use with Gson as ingson.toJson(json, new AsciiJsonWriter(new BufferedWriter(writer)));
-
-
Constructor Summary
Constructors Constructor Description AsciiJsonWriter(java.io.Writer writer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
void
write(char[] cbuf, int off, int len)
-
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classjava.io.Writer
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Specified by:
flush
in classjava.io.Writer
- Throws:
java.io.IOException
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOException
- Specified by:
write
in classjava.io.Writer
- Throws:
java.io.IOException
-
-