Package org.beanio.stream.json
Class JsonWriterSupport
- java.lang.Object
-
- org.beanio.stream.json.JsonWriterSupport
-
- Direct Known Subclasses:
JsonRecordMarshaller,JsonWriter
public abstract class JsonWriterSupport extends java.lang.ObjectBase class for writing a JSON formatted stream. Theinit(Writer, JsonParserConfiguration)method must be invoked before any writeXXX method.- Since:
- 2.0
- See Also:
JsonRecordParserFactory
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intgetIndent()protected java.lang.StringgetLineSeparator()protected voidinit(java.io.Writer out, JsonParserConfiguration config)Initializes this object.protected booleanisPretty()protected voidwrite(java.util.Map<java.lang.String,java.lang.Object> map)Writes aMapin JSON object format.protected voidwriteArray(java.lang.Iterable<java.lang.Object> iterable)Writes anIterablein JSON array format.protected voidwriteString(java.lang.String text)Writes aStringin JSON string format.protected voidwriteValue(java.lang.Object value)Writes a value in JSON format.
-
-
-
Method Detail
-
init
protected void init(java.io.Writer out, JsonParserConfiguration config)Initializes this object.- Parameters:
out- theWriterto write toconfig- theJsonParserConfiguration
-
write
protected void write(java.util.Map<java.lang.String,java.lang.Object> map) throws java.io.IOExceptionWrites aMapin JSON object format.- Parameters:
map- the Map to write- Throws:
java.io.IOException
-
writeValue
protected void writeValue(java.lang.Object value) throws java.io.IOExceptionWrites a value in JSON format. The value must be aString,Number,Boolean,MaporIterable(array), or elseObject.toString()is called and the value is formatted as a JSON string.- Parameters:
value- theObjectto write- Throws:
java.io.IOException
-
writeString
protected void writeString(java.lang.String text) throws java.io.IOExceptionWrites aStringin JSON string format.- Parameters:
text- theStringto write- Throws:
java.io.IOException
-
writeArray
protected void writeArray(java.lang.Iterable<java.lang.Object> iterable) throws java.io.IOExceptionWrites anIterablein JSON array format.- Parameters:
iterable- theIterableto write- Throws:
java.io.IOException
-
isPretty
protected boolean isPretty()
-
getIndent
protected int getIndent()
-
getLineSeparator
protected java.lang.String getLineSeparator()
-
-