|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.hpi.fgis.dude.util.data.json.DuDeJsonGenerator
public class DuDeJsonGenerator
DuDeJsonGenerator
is another implementation for generating Json code. It is used by Jsonable.toJson(DuDeJsonGenerator)
. This
approach is faster than the old implementation {Jsonable#toJsonString(int)} but slower than {Jsonable#toJsonString()}.
Constructor Summary | |
---|---|
protected |
DuDeJsonGenerator(org.codehaus.jackson.JsonGenerator generator)
Initializes a new DuDeJsonGenerator with the given generator. |
|
DuDeJsonGenerator(OutputStream outStream)
Initializes a new DuDeJsonGenerator . |
|
DuDeJsonGenerator(Writer writer)
Initializes a new DuDeJsonGenerator . |
Method Summary | |
---|---|
void |
close()
|
void |
disableFormattedJson()
Disables formatted Json. |
void |
enableFormattedJson()
Enables formatted Json. |
void |
flush()
Flushes the internal buffer. |
void |
writeArrayEnd()
Writes an array end into the stream. |
void |
writeArrayRecordEntry(String fieldname,
Collection<? extends Jsonable> jsonables)
Writes a new collection record entry into the stream |
void |
writeArrayStart()
Writes an array start into the stream. |
void |
writeBoolean(boolean value)
Writes a raw boolean into the stream. |
void |
writeBooleanRecordEntry(String fieldname,
boolean value)
Writes a new boolean record entry into the stream |
void |
writeJsonArray(JsonArray array)
Writes the passed JsonArray . |
void |
writeJsonBoolean(JsonBoolean value)
Writes the passed JsonBoolean . |
void |
writeJsonNull()
Writes a JsonNull value to the stream. |
void |
writeJsonNumber(JsonNumber value)
Writes the passed JsonNumber . |
void |
writeJsonRecord(JsonRecord record)
Writes the passed JsonRecord . |
void |
writeJsonString(JsonString value)
Writes the passed JsonString . |
void |
writeJsonValue(JsonValue value)
Writes the passed JsonValue . |
void |
writeNumber(Number number)
Writes a raw string into the stream. |
void |
writeNumberRecordEntry(String fieldname,
Number value)
Writes a new number record entry into the stream |
void |
writeRecord(AutoJsonable jsonable)
Writes a new record entry into the stream |
void |
writeRecordEnd()
Writes a record end into the stream. |
void |
writeRecordEntry(String fieldname,
AutoJsonable jsonable)
Writes a new record entry into the stream |
void |
writeRecordEntry(String fieldname,
Jsonable jsonable)
Writes a new record entry into the stream |
void |
writeRecordEntry(String fieldname,
JsonValue value)
Writes a new record entry into the stream |
void |
writeRecordFieldName(String fieldname)
Writes a new field name into the stream. |
void |
writeRecordStart()
Writes a record start into the stream. |
void |
writeString(String string)
Writes a raw string into the stream. |
void |
writeStringRecordEntry(String fieldname,
String value)
Writes a new string record entry into the stream |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DuDeJsonGenerator(OutputStream outStream) throws IOException
DuDeJsonGenerator
.
outStream
- The stream that is used for the output.
IOException
- If an error occurs while accessing the writer
.
NullPointerException
- If null
was passed instead of a OutputStream
.public DuDeJsonGenerator(Writer writer) throws IOException
DuDeJsonGenerator
.
writer
- The writer that is used internally.
IOException
- If an error occurs while accessing the writer
.
NullPointerException
- If null
was passed instead of a Writer
.protected DuDeJsonGenerator(org.codehaus.jackson.JsonGenerator generator)
DuDeJsonGenerator
with the given generator.
generator
- The generator to wrap
NullPointerException
- If null
was passed instead of a JsonGenerator
.Method Detail |
---|
public void flush() throws IOException
IOException
- If an error occurs while flushing the data.public void enableFormattedJson()
public void disableFormattedJson()
public void writeJsonValue(JsonValue value) throws org.codehaus.jackson.JsonGenerationException, IOException
JsonValue
.
value
- The JsonValue
that shall be converted into Json code.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeJsonArray(JsonArray array) throws org.codehaus.jackson.JsonGenerationException, IOException
JsonArray
.
array
- The JsonArray
that shall be converted into Json code.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeJsonBoolean(JsonBoolean value) throws org.codehaus.jackson.JsonGenerationException, IOException
JsonBoolean
.
value
- The JsonBoolean
that shall be converted into Json code.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeJsonNull() throws org.codehaus.jackson.JsonGenerationException, IOException
JsonNull
value to the stream.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeJsonNumber(JsonNumber value) throws org.codehaus.jackson.JsonGenerationException, IOException
JsonNumber
.
value
- The JsonNumber
that shall be converted into Json code.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeJsonRecord(JsonRecord record) throws org.codehaus.jackson.JsonGenerationException, IOException
JsonRecord
.
record
- The JsonRecord
that shall be converted into Json code.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeJsonString(JsonString value) throws org.codehaus.jackson.JsonGenerationException, IOException
JsonString
.
value
- The JsonString
that shall be converted into Json code.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeRecordStart() throws org.codehaus.jackson.JsonGenerationException, IOException
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeRecordEnd() throws org.codehaus.jackson.JsonGenerationException, IOException
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeArrayStart() throws org.codehaus.jackson.JsonGenerationException, IOException
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeArrayEnd() throws org.codehaus.jackson.JsonGenerationException, IOException
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeRecordEntry(String fieldname, JsonValue value) throws org.codehaus.jackson.JsonGenerationException, IOException
fieldname
- The field name of the entry.value
- The JsonValue
that shall be converted into Json code.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeRecordFieldName(String fieldname) throws org.codehaus.jackson.JsonGenerationException, IOException
fieldname
- The field name.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void close() throws IOException
close
in interface Closeable
IOException
public void writeString(String string) throws org.codehaus.jackson.JsonGenerationException, IOException
string
- The string to write
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeNumber(Number number) throws org.codehaus.jackson.JsonGenerationException, IOException
number
- The number to write
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeBoolean(boolean value) throws org.codehaus.jackson.JsonGenerationException, IOException
value
- The value to write
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeStringRecordEntry(String fieldname, String value) throws org.codehaus.jackson.JsonGenerationException, IOException
fieldname
- The field name of the entry.value
- The string to write
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeNumberRecordEntry(String fieldname, Number value) throws org.codehaus.jackson.JsonGenerationException, IOException
fieldname
- The field name of the entry.value
- The number to write
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeBooleanRecordEntry(String fieldname, boolean value) throws org.codehaus.jackson.JsonGenerationException, IOException
fieldname
- The field name of the entry.value
- The boolean to write
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeArrayRecordEntry(String fieldname, Collection<? extends Jsonable> jsonables) throws org.codehaus.jackson.JsonGenerationException, IOException
fieldname
- The field name of the entry.jsonables
- The collection of Jsonable
s to write
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeRecordEntry(String fieldname, Jsonable jsonable) throws org.codehaus.jackson.JsonGenerationException, IOException
fieldname
- The field name of the entry.jsonable
- The Jsonable
to write
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeRecordEntry(String fieldname, AutoJsonable jsonable) throws org.codehaus.jackson.JsonGenerationException, IOException
fieldname
- The field name of the entry.jsonable
- The Jsonable
to write
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.public void writeRecord(AutoJsonable jsonable) throws org.codehaus.jackson.JsonGenerationException, IOException
jsonable
- The Jsonable
to write
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while accessing the underlying stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |