Interface JsonGenerator
- All Superinterfaces:
AutoCloseable,Closeable
Abstracts Jacksons JsonGenerator for more fine-grained, incremental creation of JSON.
- Author:
- Holger Eichelberger, SSE
-
Method Summary
Modifier and TypeMethodDescriptionvoidwriteArray(double[] array, int offset, int length) Value write method that can be called to write a single array.voidwriteArray(int[] array, int offset, int length) Value write method that can be called to write a single array.voidwriteArray(long[] array, int offset, int length) Value write method that can be called to write a single array.voidwriteArray(String[] array, int offset, int length) Value write method that can be called to write a single array.voidwriteBoolean(boolean value) Method for outputting literal JSON boolean value (one of Strings 'true' and 'false').voidMethod for writing closing marker of a JSON Array value.voidMethod for writing closing marker of an Object value.voidwriteFieldName(String name) Method for writing a field name.voidMethod for outputting literal JSON null value.voidwriteNumber(double number) Method for outputting indicate JSON numeric value.voidwriteNumber(float number) Method for outputting indicate JSON numeric value.voidwriteNumber(int number) Method for outputting given value as JSON number.voidwriteNumber(long number) Method for outputting given value as JSON number.voidwriteNumber(short number) Method for outputting given value as JSON number.voidwriteNumber(BigDecimal number) Method for outputting indicate JSON numeric value.voidwriteNumber(BigInteger number) Method for outputting given value as JSON number.voidwriteObject(Object pojo) Method for writing given Java object (POJO) as Json.voidMethod for writing starting marker of a Array value.voidMethod for writing starting marker of an Object value.voidwriteString(String text) Method for outputting a String value.
-
Method Details
-
writeNumber
Method for outputting given value as JSON number. Can be called in any context where a value is expected (Array value, Object field value, root-level value).- Parameters:
number- value to write- Throws:
IOException- when the number cannot be written
-
writeNumber
Method for outputting given value as JSON number. Can be called in any context where a value is expected (Array value, Object field value, root-level value).- Parameters:
number- value to write- Throws:
IOException- when the number cannot be written
-
writeNumber
Method for outputting given value as JSON number. Can be called in any context where a value is expected (Array value, Object field value, root-level value).- Parameters:
number- value to write- Throws:
IOException- when the number cannot be written
-
writeNumber
Method for outputting given value as JSON number. Can be called in any context where a value is expected (Array value, Object field value, root-level value).- Parameters:
number- value to write- Throws:
IOException- when the number cannot be written
-
writeNumber
Method for outputting indicate JSON numeric value. Can be called in any context where a value is expected (Array value, Object field value, root-level value).- Parameters:
number- value to write- Throws:
IOException- when the number cannot be written
-
writeNumber
Method for outputting indicate JSON numeric value. Can be called in any context where a value is expected (Array value, Object field value, root-level value).- Parameters:
number- value to write- Throws:
IOException- when the number cannot be written
-
writeNumber
Method for outputting indicate JSON numeric value. Can be called in any context where a value is expected (Array value, Object field value, root-level value).- Parameters:
number- value to write- Throws:
IOException- when the number cannot be written
-
writeString
Method for outputting a String value. Depending on context this means either array element, (object) field value or a stand alone String; but in all cases, String will be surrounded in double quotes, and contents will be properly escaped as required by JSON specification.- Parameters:
text- value to write- Throws:
IOException- when the text cannot be written
-
writeBoolean
Method for outputting literal JSON boolean value (one of Strings 'true' and 'false'). Can be called in any context where a value is expected (Array value, Object field value, root-level value).- Parameters:
value- the value to write- Throws:
IOException- when the value cannot be written
-
writeNull
Method for outputting literal JSON null value. Can be called in any context where a value is expected (Array value, Object field value, root-level value).- Throws:
IOException- when the value cannot be written
-
writeArray
Value write method that can be called to write a single array.- Parameters:
array- Array that contains values to writeoffset- Offset of the first element to write, within arraylength- Number of elements in array to write, from `offset` to `offset + len - 1`- Throws:
IOException- when the array cannot be written
-
writeArray
Value write method that can be called to write a single array.- Parameters:
array- Array that contains values to writeoffset- Offset of the first element to write, within arraylength- Number of elements in array to write, from `offset` to `offset + len - 1`- Throws:
IOException- when the array cannot be written- Since:
- 2.8
-
writeArray
Value write method that can be called to write a single array.- Parameters:
array- Array that contains values to writeoffset- Offset of the first element to write, within arraylength- Number of elements in array to write, from `offset` to `offset + len - 1`- Throws:
IOException- when the array cannot be written
-
writeArray
Value write method that can be called to write a single array.- Parameters:
array- Array that contains values to writeoffset- Offset of the first element to write, within arraylength- Number of elements in array to write, from `offset` to `offset + len - 1`- Throws:
IOException- when the array cannot be written
-
writeStartArray
Method for writing starting marker of a Array value. Array values can be written in any context where values are allowed: meaning everywhere except for when a field name is expected.- Throws:
IOException- when the array cannot be written
-
writeEndArray
Method for writing closing marker of a JSON Array value. Marker can be written if the innermost structured type is Array.- Throws:
IOException- when the array cannot be written
-
writeStartObject
Method for writing starting marker of an Object value. Object values can be written in any context where values are allowed: meaning everywhere except for when a field name is expected.- Throws:
IOException- when the object cannot be written
-
writeEndObject
Method for writing closing marker of an Object value. Marker can be written if the innermost structured type is Object, and the last written event was either a complete value, or a start object.- Throws:
IOException- when the object cannot be written
-
writeFieldName
Method for writing a field name. Field names can only be written in Object context , when field name is expected (field names alternate with values).- Throws:
IOException- when the name cannot be written
-
writeObject
Method for writing given Java object (POJO) as Json.- Throws:
IOException- when the object cannot be written
-