JSON
Version 1.0

org.codehaus.jackson.impl
Class WriterBasedGenerator

java.lang.Object
  extended by org.codehaus.jackson.JsonGenerator
      extended by org.codehaus.jackson.impl.JsonGeneratorBase
          extended by org.codehaus.jackson.impl.WriterBasedGenerator

public final class WriterBasedGenerator
extends JsonGeneratorBase


Field Summary
protected  char[] mEntityBuffer
          6-char temporary buffer allocated if needed, for constructing escape sequences
protected  IOContext mIOContext
           
protected  char[] mOutputBuffer
          Intermediate buffer in which contents are buffered before being written using mWriter.
protected  int mOutputEnd
           
protected  int mOutputHead
           
protected  int mOutputTail
           
protected  Writer mWriter
           
 
Fields inherited from class org.codehaus.jackson.impl.JsonGeneratorBase
mWriteContext
 
Fields inherited from class org.codehaus.jackson.JsonGenerator
mPrettyPrinter
 
Constructor Summary
WriterBasedGenerator(IOContext ctxt, Writer w)
           
 
Method Summary
 void close()
           
protected  void doWriteEndArray()
           
protected  void doWriteEndObject()
           
 void doWriteFieldName(String name, boolean commaBefore)
           
protected  void doWriteStartArray()
           
protected  void doWriteStartObject()
           
 void flush()
           
protected  void flushBuffer()
           
protected  void releaseBuffers()
           
protected  void verifyValueWrite(String typeMsg)
           
 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).
 void writeBoolean(boolean state)
           
 void writeNull()
           
 void writeNumber(BigDecimal dec)
           
 void writeNumber(double d)
           
 void writeNumber(float f)
           
 void writeNumber(int i)
           
 void writeNumber(long l)
           
 void writeRaw(char c)
           
 void writeRaw(char[] text, int offset, int len)
           
 void writeRaw(String text)
          Fallback method which can be used to make generator copy input text verbatim with no modifications
 void writeRaw(String text, int start, int len)
           
 void writeString(char[] text, int offset, int len)
           
 void writeString(String text)
           
 
Methods inherited from class org.codehaus.jackson.impl.JsonGeneratorBase
reportError, useDefaultPrettyPrinter, writeEndArray, writeEndObject, writeFieldName, writeStartArray, writeStartObject
 
Methods inherited from class org.codehaus.jackson.JsonGenerator
setPrettyPrinter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mIOContext

protected final IOContext mIOContext

mWriter

protected final Writer mWriter

mOutputBuffer

protected char[] mOutputBuffer
Intermediate buffer in which contents are buffered before being written using mWriter.


mOutputHead

protected int mOutputHead

mOutputTail

protected int mOutputTail

mOutputEnd

protected int mOutputEnd

mEntityBuffer

protected char[] mEntityBuffer
6-char temporary buffer allocated if needed, for constructing escape sequences

Constructor Detail

WriterBasedGenerator

public WriterBasedGenerator(IOContext ctxt,
                            Writer w)
Method Detail

doWriteStartArray

protected void doWriteStartArray()
                          throws IOException,
                                 JsonGenerationException
Specified by:
doWriteStartArray in class JsonGeneratorBase
Throws:
IOException
JsonGenerationException

doWriteEndArray

protected void doWriteEndArray()
                        throws IOException,
                               JsonGenerationException
Specified by:
doWriteEndArray in class JsonGeneratorBase
Throws:
IOException
JsonGenerationException

doWriteStartObject

protected void doWriteStartObject()
                           throws IOException,
                                  JsonGenerationException
Specified by:
doWriteStartObject in class JsonGeneratorBase
Throws:
IOException
JsonGenerationException

doWriteEndObject

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

doWriteFieldName

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

writeString

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

writeString

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

writeRaw

public 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 JsonGeneratorBase
Throws:
IOException
JsonGenerationException

writeRaw

public void writeRaw(String text,
                     int start,
                     int len)
              throws IOException,
                     JsonGenerationException
Specified by:
writeRaw in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeRaw

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

writeRaw

public void writeRaw(char c)
              throws IOException,
                     JsonGenerationException
Specified by:
writeRaw in class JsonGenerator
Throws:
IOException
JsonGenerationException

writeBinary

public 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 JsonGeneratorBase
Throws:
IOException
JsonGenerationException

writeNumber

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

writeNumber

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

writeNumber

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

writeNumber

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

writeNumber

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

writeBoolean

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

writeNull

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

verifyValueWrite

protected final void verifyValueWrite(String typeMsg)
                               throws IOException,
                                      JsonGenerationException
Specified by:
verifyValueWrite in class JsonGeneratorBase
Throws:
IOException
JsonGenerationException

flush

public final void flush()
                 throws IOException
Specified by:
flush in class JsonGeneratorBase
Throws:
IOException

close

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

releaseBuffers

protected void releaseBuffers()
Specified by:
releaseBuffers in class JsonGeneratorBase

flushBuffer

protected void flushBuffer()
                    throws IOException
Throws:
IOException

JSON
Version 1.0

Apache License, Version 2.0