Package aQute.lib.json
Class Encoder
- java.lang.Object
-
- aQute.lib.json.Encoder
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class Encoder extends java.lang.Object implements java.lang.Appendable, java.io.Closeable, java.io.Flushable
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.Appendableapp(package private) booleanclosed(package private) JSONCodeccodec(package private) booleandeflate(package private) java.security.MessageDigestdigest(package private) java.nio.charset.Charsetencoding(package private) java.lang.Stringindent(package private) booleankeepOpen(package private) java.lang.Stringlinebreak(package private) java.lang.Stringtabs(package private) booleanwriteDefaults
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Appendableappend(char c)java.lang.Appendableappend(java.lang.CharSequence sq)java.lang.Appendableappend(java.lang.CharSequence sq, int start, int length)Encodercharset(java.lang.String encoding)Encodercharset(java.nio.charset.Charset encoding)voidclose()Encoderdeflate()byte[]digest()(package private) voidencode(java.lang.Object object, java.lang.reflect.Type type, java.util.Map<java.lang.Object,java.lang.reflect.Type> visited)voidflush()(package private) voidindent()Encoderindent(java.lang.String tabs)EncoderkeepOpen()(package private) voidlinebreak()Encoderlinebreak(java.lang.String linebreak)Encodermark()Encoderput(java.lang.Object object)Encoderto()Encoderto(java.io.File file)Encoderto(java.io.OutputStream out)Encoderto(java.lang.Appendable out)java.lang.StringtoString()(package private) voidundent()EncoderwriteDefaults()
-
-
-
Field Detail
-
codec
final JSONCodec codec
-
app
java.lang.Appendable app
-
digest
java.security.MessageDigest digest
-
writeDefaults
boolean writeDefaults
-
encoding
java.nio.charset.Charset encoding
-
deflate
boolean deflate
-
tabs
java.lang.String tabs
-
indent
java.lang.String indent
-
linebreak
java.lang.String linebreak
-
keepOpen
boolean keepOpen
-
closed
boolean closed
-
-
Constructor Detail
-
Encoder
Encoder(JSONCodec codec)
-
-
Method Detail
-
put
public Encoder put(java.lang.Object object) throws java.lang.Exception
- Throws:
java.lang.Exception
-
mark
public Encoder mark() throws java.security.NoSuchAlgorithmException
- Throws:
java.security.NoSuchAlgorithmException
-
digest
public byte[] digest() throws java.security.NoSuchAlgorithmException, java.io.IOException- Throws:
java.security.NoSuchAlgorithmExceptionjava.io.IOException
-
to
public Encoder to() throws java.io.IOException
- Throws:
java.io.IOException
-
to
public Encoder to(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
charset
public Encoder charset(java.lang.String encoding)
-
charset
public Encoder charset(java.nio.charset.Charset encoding)
-
to
public Encoder to(java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
to
public Encoder to(java.lang.Appendable out) throws java.io.IOException
- Throws:
java.io.IOException
-
append
public java.lang.Appendable append(char c) throws java.io.IOException- Specified by:
appendin interfacejava.lang.Appendable- Throws:
java.io.IOException
-
append
public java.lang.Appendable append(java.lang.CharSequence sq) throws java.io.IOException- Specified by:
appendin interfacejava.lang.Appendable- Throws:
java.io.IOException
-
append
public java.lang.Appendable append(java.lang.CharSequence sq, int start, int length) throws java.io.IOException- Specified by:
appendin interfacejava.lang.Appendable- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
encode
void encode(java.lang.Object object, java.lang.reflect.Type type, java.util.Map<java.lang.Object,java.lang.reflect.Type> visited) throws java.lang.Exception- Throws:
java.lang.Exception
-
writeDefaults
public Encoder writeDefaults()
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Throws:
java.io.IOException
-
deflate
public Encoder deflate()
-
indent
public Encoder indent(java.lang.String tabs)
-
linebreak
public Encoder linebreak(java.lang.String linebreak)
-
undent
void undent() throws java.io.IOException- Throws:
java.io.IOException
-
linebreak
void linebreak() throws java.io.IOException- Throws:
java.io.IOException
-
indent
void indent() throws java.io.IOException- Throws:
java.io.IOException
-
keepOpen
public Encoder keepOpen()
-
-