JSON
Version 1.0

org.codehaus.jackson.impl
Class JsonGeneratorBase

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

public abstract class JsonGeneratorBase
extends JsonGenerator

This base class defines API that a JSON generator exposes to applications, as well as internal API that sub-classes have to implement.


Field Summary
protected  JsonWriteContext mWriteContext
           
 
Fields inherited from class org.codehaus.jackson.JsonGenerator
mPrettyPrinter
 
Constructor Summary
protected JsonGeneratorBase()
           
 
Method Summary
abstract  void close()
           
protected abstract  void doWriteEndArray()
           
protected abstract  void doWriteEndObject()
           
abstract  void doWriteFieldName(String name, boolean commaBefore)
           
protected abstract  void doWriteStartArray()
           
protected abstract  void doWriteStartObject()
           
abstract  void flush()
           
protected abstract  void releaseBuffers()
           
protected  void reportError(String msg)
           
 void useDefaultPrettyPrinter()
          Convenience method for enabling pretty-printing using the default pretty printer (DefaultPrettyPrinter).
protected abstract  void verifyValueWrite(String typeMsg)
           
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)
           
 void writeEndArray()
           
 void writeEndObject()
           
 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[] 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
 void writeStartArray()
           
 void writeStartObject()
           
abstract  void writeString(char[] text, int offset, int len)
           
abstract  void writeString(String text)
           
 
Methods inherited from class org.codehaus.jackson.JsonGenerator
setPrettyPrinter, writeRaw, writeRaw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mWriteContext

protected JsonWriteContext mWriteContext
Constructor Detail

JsonGeneratorBase

protected JsonGeneratorBase()
Method Detail

useDefaultPrettyPrinter

public final void useDefaultPrettyPrinter()
Description copied from class: JsonGenerator
Convenience method for enabling pretty-printing using the default pretty printer (DefaultPrettyPrinter).

Specified by:
useDefaultPrettyPrinter in class JsonGenerator

writeStartArray

public void writeStartArray()
                     throws IOException,
                            JsonGenerationException
Specified by:
writeStartArray in class JsonGenerator
Throws:
IOException
JsonGenerationException

doWriteStartArray

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

writeEndArray

public void writeEndArray()
                   throws IOException,
                          JsonGenerationException
Specified by:
writeEndArray in class JsonGenerator
Throws:
IOException
JsonGenerationException

doWriteEndArray

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

writeStartObject

public void writeStartObject()
                      throws IOException,
                             JsonGenerationException
Specified by:
writeStartObject in class JsonGenerator
Throws:
IOException
JsonGenerationException

doWriteStartObject

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

writeEndObject

public void writeEndObject()
                    throws IOException,
                           JsonGenerationException
Specified by:
writeEndObject in class JsonGenerator
Throws:
IOException
JsonGenerationException

doWriteEndObject

protected abstract void doWriteEndObject()
                                  throws IOException,
                                         JsonGenerationException
Specified by:
doWriteEndObject in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeFieldName

public void writeFieldName(String name)
                    throws IOException,
                           JsonGenerationException
Specified by:
writeFieldName in class JsonGenerator
Throws:
IOException
JsonGenerationException

doWriteFieldName

public abstract void doWriteFieldName(String name,
                                      boolean commaBefore)
                               throws IOException,
                                      JsonGenerationException
Specified by:
doWriteFieldName in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeString

public abstract void writeString(String text)
                          throws IOException,
                                 JsonGenerationException
Specified by:
writeString in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeString

public abstract void writeString(char[] text,
                                 int offset,
                                 int len)
                          throws IOException,
                                 JsonGenerationException
Specified by:
writeString in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeRaw

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

Specified by:
writeRaw in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeRaw

public abstract void writeRaw(char[] text,
                              int offset,
                              int len)
                       throws IOException,
                              JsonGenerationException
Specified by:
writeRaw in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeBinary

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

Specified by:
writeBinary in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeNumber

public abstract void writeNumber(int i)
                          throws IOException,
                                 JsonGenerationException
Specified by:
writeNumber in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeNumber

public abstract void writeNumber(long l)
                          throws IOException,
                                 JsonGenerationException
Specified by:
writeNumber in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeNumber

public abstract void writeNumber(double d)
                          throws IOException,
                                 JsonGenerationException
Specified by:
writeNumber in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeNumber

public abstract void writeNumber(float f)
                          throws IOException,
                                 JsonGenerationException
Specified by:
writeNumber in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeNumber

public abstract void writeNumber(BigDecimal dec)
                          throws IOException,
                                 JsonGenerationException
Specified by:
writeNumber in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeBoolean

public abstract void writeBoolean(boolean state)
                           throws IOException,
                                  JsonGenerationException
Specified by:
writeBoolean in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeNull

public abstract void writeNull()
                        throws IOException,
                               JsonGenerationException
Specified by:
writeNull in class JsonGenerator
Throws:
IOException
JsonGenerationException

releaseBuffers

protected abstract void releaseBuffers()

flush

public abstract void flush()
                    throws IOException
Specified by:
flush in class JsonGenerator
Throws:
IOException

close

public abstract void close()
                    throws IOException
Specified by:
close in class JsonGenerator
Throws:
IOException

verifyValueWrite

protected abstract void verifyValueWrite(String typeMsg)
                                  throws IOException,
                                         JsonGenerationException
Throws:
IOException
JsonGenerationException

reportError

protected void reportError(String msg)
                    throws JsonGenerationException
Throws:
JsonGenerationException

JSON
Version 1.0

Apache License, Version 2.0