Class 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.Appendable app  
      (package private) boolean closed  
      (package private) JSONCodec codec  
      (package private) boolean deflate  
      (package private) java.security.MessageDigest digest  
      (package private) java.nio.charset.Charset encoding  
      (package private) java.lang.String indent  
      (package private) boolean keepOpen  
      (package private) java.lang.String tabs  
      (package private) boolean writeDefaults  
    • Constructor Summary

      Constructors 
      Constructor Description
      Encoder​(JSONCodec codec)  
    • Field Detail

      • 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
      • keepOpen

        boolean keepOpen
      • closed

        boolean closed
    • Constructor Detail

    • 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.NoSuchAlgorithmException
        java.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:
        append in interface java.lang.Appendable
        Throws:
        java.io.IOException
      • append

        public java.lang.Appendable append​(java.lang.CharSequence sq)
                                    throws java.io.IOException
        Specified by:
        append in interface java.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:
        append in interface java.lang.Appendable
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.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:
        flush in interface java.io.Flushable
        Throws:
        java.io.IOException
      • deflate

        public Encoder deflate()
      • indent

        public Encoder indent​(java.lang.String tabs)
      • undent

        void undent()
             throws java.io.IOException
        Throws:
        java.io.IOException
      • indent

        void indent()
             throws java.io.IOException
        Throws:
        java.io.IOException
      • keepOpen

        public Encoder keepOpen()