Class JsonGenerator

    • Constructor Summary

      Constructors 
      Constructor Description
      JsonGenerator()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void close()
      Closes the serializer and the underlying output stream or writer, and releases any memory associated with it.
      void enablePrettyPrint()
      Requests that the output be pretty printed (by default it is not).
      abstract void flush()
      Flushes any buffered content to the underlying output stream or writer.
      abstract JsonFactory getFactory()
      Returns the JSON factory from which this generator was created.
      private void serialize​(boolean isJsonString, java.lang.Object value)  
      void serialize​(java.lang.Object value)
      Serializes the given JSON value object, or if value is null it does no serialization.
      abstract void writeBoolean​(boolean state)
      Writes a literal JSON boolean value ('true' or 'false').
      abstract void writeEndArray()
      Writes a JSON end array character ']'.
      abstract void writeEndObject()
      Writes a JSON end object character '}'.
      abstract void writeFieldName​(java.lang.String name)
      Writes a JSON quoted field name.
      abstract void writeNull()
      Writes a literal JSON null value.
      abstract void writeNumber​(double v)
      Writes a JSON double value.
      abstract void writeNumber​(float v)
      Writes a JSON float value.
      abstract void writeNumber​(int v)
      Writes a JSON int value.
      abstract void writeNumber​(long v)
      Writes a JSON long value.
      abstract void writeNumber​(java.lang.String encodedValue)
      Writes a JSON numeric value that has already been encoded properly.
      abstract void writeNumber​(java.math.BigDecimal v)
      Writes a JSON big decimal value.
      abstract void writeNumber​(java.math.BigInteger v)
      Writes a JSON big integer value.
      abstract void writeStartArray()
      Writes a JSON start array character '['.
      abstract void writeStartObject()
      Writes a JSON start object character '{'.
      abstract void writeString​(java.lang.String value)
      Writes a JSON quoted string value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JsonGenerator

        public JsonGenerator()
    • Method Detail

      • getFactory

        public abstract JsonFactory getFactory()
        Returns the JSON factory from which this generator was created.
      • flush

        public abstract void flush()
                            throws java.io.IOException
        Flushes any buffered content to the underlying output stream or writer.
        Throws:
        java.io.IOException
      • close

        public abstract void close()
                            throws java.io.IOException
        Closes the serializer and the underlying output stream or writer, and releases any memory associated with it.
        Throws:
        java.io.IOException
      • writeStartArray

        public abstract void writeStartArray()
                                      throws java.io.IOException
        Writes a JSON start array character '['.
        Throws:
        java.io.IOException
      • writeEndArray

        public abstract void writeEndArray()
                                    throws java.io.IOException
        Writes a JSON end array character ']'.
        Throws:
        java.io.IOException
      • writeStartObject

        public abstract void writeStartObject()
                                       throws java.io.IOException
        Writes a JSON start object character '{'.
        Throws:
        java.io.IOException
      • writeEndObject

        public abstract void writeEndObject()
                                     throws java.io.IOException
        Writes a JSON end object character '}'.
        Throws:
        java.io.IOException
      • writeFieldName

        public abstract void writeFieldName​(java.lang.String name)
                                     throws java.io.IOException
        Writes a JSON quoted field name.
        Throws:
        java.io.IOException
      • writeNull

        public abstract void writeNull()
                                throws java.io.IOException
        Writes a literal JSON null value.
        Throws:
        java.io.IOException
      • writeString

        public abstract void writeString​(java.lang.String value)
                                  throws java.io.IOException
        Writes a JSON quoted string value.
        Throws:
        java.io.IOException
      • writeBoolean

        public abstract void writeBoolean​(boolean state)
                                   throws java.io.IOException
        Writes a literal JSON boolean value ('true' or 'false').
        Throws:
        java.io.IOException
      • writeNumber

        public abstract void writeNumber​(int v)
                                  throws java.io.IOException
        Writes a JSON int value.
        Throws:
        java.io.IOException
      • writeNumber

        public abstract void writeNumber​(long v)
                                  throws java.io.IOException
        Writes a JSON long value.
        Throws:
        java.io.IOException
      • writeNumber

        public abstract void writeNumber​(java.math.BigInteger v)
                                  throws java.io.IOException
        Writes a JSON big integer value.
        Throws:
        java.io.IOException
      • writeNumber

        public abstract void writeNumber​(float v)
                                  throws java.io.IOException
        Writes a JSON float value.
        Throws:
        java.io.IOException
      • writeNumber

        public abstract void writeNumber​(double v)
                                  throws java.io.IOException
        Writes a JSON double value.
        Throws:
        java.io.IOException
      • writeNumber

        public abstract void writeNumber​(java.math.BigDecimal v)
                                  throws java.io.IOException
        Writes a JSON big decimal value.
        Throws:
        java.io.IOException
      • writeNumber

        public abstract void writeNumber​(java.lang.String encodedValue)
                                  throws java.io.IOException
        Writes a JSON numeric value that has already been encoded properly.
        Throws:
        java.io.IOException
      • serialize

        public final void serialize​(java.lang.Object value)
                             throws java.io.IOException
        Serializes the given JSON value object, or if value is null it does no serialization.
        Throws:
        java.io.IOException
      • serialize

        private void serialize​(boolean isJsonString,
                               java.lang.Object value)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • enablePrettyPrint

        public void enablePrettyPrint()
                               throws java.io.IOException
        Requests that the output be pretty printed (by default it is not).

        Default implementation does nothing, but implementations may override to provide actual pretty printing.

        Throws:
        java.io.IOException - possible I/O exception (unused in default implementation)
        Since:
        1.6