BeanIO 2.0.4

org.beanio.stream.json
Class JsonWriterSupport

java.lang.Object
  extended by org.beanio.stream.json.JsonWriterSupport
Direct Known Subclasses:
JsonRecordMarshaller, JsonWriter

public abstract class JsonWriterSupport
extends Object

Base class for writing a JSON formatted stream. The init(Writer, JsonParserConfiguration) method must be invoked before any writeXXX method.

Since:
2.0
Author:
Kevin Seim
See Also:
JsonRecordParserFactory

Method Summary
protected  int getIndent()
           
protected  String getLineSeparator()
           
protected  void init(Writer out, JsonParserConfiguration config)
          Initializes this object.
protected  boolean isPretty()
           
protected  void write(Map<String,Object> map)
          Writes a Map in JSON object format.
protected  void writeArray(Iterable<Object> iterable)
          Writes an Iterable in JSON array format.
protected  void writeString(String text)
          Writes a String in JSON string format.
protected  void writeValue(Object value)
          Writes a value in JSON format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

protected void init(Writer out,
                    JsonParserConfiguration config)
Initializes this object.

Parameters:
out - the Writer to write to
config - the JsonParserConfiguration

write

protected void write(Map<String,Object> map)
              throws IOException
Writes a Map in JSON object format.

Parameters:
map - the Map to write
Throws:
IOException

writeValue

protected void writeValue(Object value)
                   throws IOException
Writes a value in JSON format. The value must be a String, Number, Boolean, Map or Iterable (array), or else Object.toString() is called and the value is formatted as a JSON string.

Parameters:
value - the Object to write
Throws:
IOException

writeString

protected void writeString(String text)
                    throws IOException
Writes a String in JSON string format.

Parameters:
text - the String to write
Throws:
IOException

writeArray

protected void writeArray(Iterable<Object> iterable)
                   throws IOException
Writes an Iterable in JSON array format.

Parameters:
iterable - the Iterable to write
Throws:
IOException

isPretty

protected boolean isPretty()

getIndent

protected int getIndent()

getLineSeparator

protected String getLineSeparator()

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim