JSON
Version 1.0

org.codehaus.jackson
Class JsonGenerator

java.lang.Object
  extended by org.codehaus.jackson.JsonGenerator
Direct Known Subclasses:
JsonGeneratorBase

public abstract class JsonGenerator
extends Object

This base class defines API for output JSON content.


Field Summary
protected  PrettyPrinter mPrettyPrinter
          Object that handles pretty-printing (usually additional white space to make results more human-readable) during output.
 
Constructor Summary
protected JsonGenerator()
           
 
Method Summary
abstract  void close()
           
protected abstract  void doWriteEndObject()
           
protected abstract  void doWriteFieldName(String name, boolean commaBefore)
           
abstract  void flush()
           
 void setPrettyPrinter(PrettyPrinter pp)
           
abstract  void useDefaultPrettyPrinter()
          Convenience method for enabling pretty-printing using the default pretty printer (DefaultPrettyPrinter).
abstract  void writeBinary(byte[] data, int offset, int len)
          Method that will output given chunk of binary data as base64 encoded, as a complete String value (surrounded by double quotes).
abstract  void writeBoolean(boolean state)
           
abstract  void writeEndArray()
           
abstract  void writeEndObject()
           
abstract  void writeFieldName(String name)
           
abstract  void writeNull()
           
abstract  void writeNumber(BigDecimal dec)
           
abstract  void writeNumber(double d)
           
abstract  void writeNumber(float f)
           
abstract  void writeNumber(int i)
           
abstract  void writeNumber(long l)
           
abstract  void writeRaw(char c)
           
abstract  void writeRaw(char[] text, int offset, int len)
           
abstract  void writeRaw(String text)
          Fallback method which can be used to make generator copy input text verbatim with no modifications
abstract  void writeRaw(String text, int offset, int len)
           
abstract  void writeStartArray()
           
abstract  void writeStartObject()
           
abstract  void writeString(char[] text, int offset, int len)
           
abstract  void writeString(String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mPrettyPrinter

protected PrettyPrinter mPrettyPrinter
Object that handles pretty-printing (usually additional white space to make results more human-readable) during output. If null, no pretty-printing is done.

Constructor Detail

JsonGenerator

protected JsonGenerator()
Method Detail

setPrettyPrinter

public final void setPrettyPrinter(PrettyPrinter pp)

useDefaultPrettyPrinter

public abstract void useDefaultPrettyPrinter()
Convenience method for enabling pretty-printing using the default pretty printer (DefaultPrettyPrinter).


writeStartArray

public abstract void writeStartArray()
                              throws IOException,
                                     JsonGenerationException
Throws:
IOException
JsonGenerationException

writeEndArray

public abstract void writeEndArray()
                            throws IOException,
                                   JsonGenerationException
Throws:
IOException
JsonGenerationException

writeStartObject

public abstract void writeStartObject()
                               throws IOException,
                                      JsonGenerationException
Throws:
IOException
JsonGenerationException

writeEndObject

public abstract void writeEndObject()
                             throws IOException,
                                    JsonGenerationException
Throws:
IOException
JsonGenerationException

doWriteEndObject

protected abstract void doWriteEndObject()
                                  throws IOException,
                                         JsonGenerationException
Throws:
IOException
JsonGenerationException

writeFieldName

public abstract void writeFieldName(String name)
                             throws IOException,
                                    JsonGenerationException
Throws:
IOException
JsonGenerationException

doWriteFieldName

protected abstract void doWriteFieldName(String name,
                                         boolean commaBefore)
                                  throws IOException,
                                         JsonGenerationException
Throws:
IOException
JsonGenerationException

writeString

public abstract void writeString(String text)
                          throws IOException,
                                 JsonGenerationException
Throws:
IOException
JsonGenerationException

writeString

public abstract void writeString(char[] text,
                                 int offset,
                                 int len)
                          throws IOException,
                                 JsonGenerationException
Throws:
IOException
JsonGenerationException

writeRaw

public abstract void writeRaw(String text)
                       throws IOException,
                              JsonGenerationException
Fallback method which can be used to make generator copy input text verbatim with no modifications

Throws:
IOException
JsonGenerationException

writeRaw

public abstract void writeRaw(String text,
                              int offset,
                              int len)
                       throws IOException,
                              JsonGenerationException
Throws:
IOException
JsonGenerationException

writeRaw

public abstract void writeRaw(char[] text,
                              int offset,
                              int len)
                       throws IOException,
                              JsonGenerationException
Throws:
IOException
JsonGenerationException

writeRaw

public abstract void writeRaw(char c)
                       throws IOException,
                              JsonGenerationException
Throws:
IOException
JsonGenerationException

writeBinary

public abstract void writeBinary(byte[] data,
                                 int offset,
                                 int len)
                          throws IOException,
                                 JsonGenerationException
Method that will output given chunk of binary data as base64 encoded, as a complete String value (surrounded by double quotes). Note:

Throws:
IOException
JsonGenerationException

writeNumber

public abstract void writeNumber(int i)
                          throws IOException,
                                 JsonGenerationException
Throws:
IOException
JsonGenerationException

writeNumber

public abstract void writeNumber(long l)
                          throws IOException,
                                 JsonGenerationException
Throws:
IOException
JsonGenerationException

writeNumber

public abstract void writeNumber(double d)
                          throws IOException,
                                 JsonGenerationException
Throws:
IOException
JsonGenerationException

writeNumber

public abstract void writeNumber(float f)
                          throws IOException,
                                 JsonGenerationException
Throws:
IOException
JsonGenerationException

writeNumber

public abstract void writeNumber(BigDecimal dec)
                          throws IOException,
                                 JsonGenerationException
Throws:
IOException
JsonGenerationException

writeBoolean

public abstract void writeBoolean(boolean state)
                           throws IOException,
                                  JsonGenerationException
Throws:
IOException
JsonGenerationException

writeNull

public abstract void writeNull()
                        throws IOException,
                               JsonGenerationException
Throws:
IOException
JsonGenerationException

flush

public abstract void flush()
                    throws IOException
Throws:
IOException

close

public abstract void close()
                    throws IOException
Throws:
IOException

JSON
Version 1.0

Apache License, Version 2.0