PREV CLASS NEXT CLASS
Tree SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD com.ibm.portal.streaming.json
Interface DefaultJsonContentHandler
- All Superinterfaces:
- JsonContentHandler, JsonContentHandlerEx
public interface DefaultJsonContentHandler- extends JsonContentHandlerEx
Convenience interface to the JsonContentHandler that allows to write high-level java objects.
Example
- the first call to this handler must be JsonContentHandler.startDocument() and the last call JsonContentHandler.endDocument()
- the value methods only write the content, they must be preceeded by a startXXX and ended by an endXXX method
- the jsonXXX methods write complete objects and already include calls to the startXXX and endXX methods
handler.startDocument(); handler.startObject(); handler.startMember("Image"); handler.startObject(); handler.jsonMember("Width", 800); handler.jsonMember("Height", 600); handler.jsonMember("Title", "View from 15th Floor"); handler.startMember("Thumbnail"); handler.startObject(); handler.jsonMember("Url", "http://www.example.com/image/481989943"); handler.jsonMember("Height", 125); handler.jsonMember("Width", "100"); handler.endObject(); handler.endMember(); handler.jsonMember("IDs", new int[] { 116, 943, 234, 38793 }); handler.endObject(); handler.endObject(); handler.endDocument();
Field Summary
Fields inherited from interface com.ibm.portal.streaming.json.JsonContentHandlerEx PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
Method Summary java.io.OutputStream getBase64OutputStream()
OutputStream used to stream a string value encoded as base64, similar to the value(String) method.DefaultJsonContentHandler getInnerJsonContentHandler()
Return a JsonContentHandler that ignores calls to JsonContentHandler.startDocument() and JsonContentHandler.endDocument() but simply passes on all other calls to the DefaultContentHandler.java.io.Writer getWriter()
Writer used to stream a string value, similar to the value(String) method.void jsonArray(boolean[] value)
void jsonArray(java.lang.Boolean[] value)
void jsonArray(byte[] value)
void jsonArray(java.lang.Byte[] value)
void jsonArray(java.util.Date[] value)
Writes an array of dates in RFC 1123 formavoid jsonArray(double[] value)
void jsonArray(java.lang.Double[] value)
void jsonArray(float[] value)
void jsonArray(java.lang.Float[] value)
void jsonArray(int[] value)
void jsonArray(java.lang.Integer[] value)
void jsonArray(java.util.Locale[] value)
Writes an array of locales in RFC 4646 formatvoid jsonArray(long[] value)
void jsonArray(java.lang.Long[] value)
void jsonArray(java.lang.Object[] value)
void jsonArray(javax.xml.namespace.QName[] value)
Writes an array of QName objectsvoid jsonArray(short[] value)
void jsonArray(java.lang.Short[] value)
void jsonArray(java.lang.String[] value)
void jsonBoolean(boolean value)
void jsonBoolean(java.lang.Boolean value)
void jsonCollection(java.util.Collection<?> value)
void jsonDate(java.util.Date value)
Writes a date in RFC 1123 formatvoid jsonDate(long value)
Writes a date in RFC 1123 formatvoid jsonLocale(java.util.Locale value)
Writes a locale in RFC 4646 formatvoid jsonMap(java.util.Map<java.lang.String,?> value)
void jsonMember(java.lang.String name)
void jsonMember(java.lang.String name, boolean value)
void jsonMember(java.lang.String name, java.lang.Boolean value)
void jsonMember(java.lang.String name, boolean[] value)
void jsonMember(java.lang.String name, java.lang.Boolean[] value)
void jsonMember(java.lang.String name, java.util.Collection<?> value)
void jsonMember(java.lang.String name, java.util.Date value)
void jsonMember(java.lang.String name, java.util.Date[] value)
void jsonMember(java.lang.String name, double value)
void jsonMember(java.lang.String name, java.lang.Double value)
void jsonMember(java.lang.String name, double[] value)
void jsonMember(java.lang.String name, java.lang.Double[] value)
void jsonMember(java.lang.String name, float value)
void jsonMember(java.lang.String name, java.lang.Float value)
void jsonMember(java.lang.String name, float[] value)
void jsonMember(java.lang.String name, java.lang.Float[] value)
void jsonMember(java.lang.String name, int value)
void jsonMember(java.lang.String name, int[] value)
void jsonMember(java.lang.String name, java.lang.Integer value)
void jsonMember(java.lang.String name, java.lang.Integer[] value)
void jsonMember(java.lang.String name, java.util.Locale value)
void jsonMember(java.lang.String name, java.util.Locale[] value)
void jsonMember(java.lang.String name, long value)
void jsonMember(java.lang.String name, java.lang.Long value)
void jsonMember(java.lang.String name, long[] value)
void jsonMember(java.lang.String name, java.lang.Long[] value)
void jsonMember(java.lang.String name, java.util.Map<java.lang.String,?> value)
void jsonMember(java.lang.String name, java.lang.Object value)
void jsonMember(java.lang.String name, java.lang.Object[] value)
void jsonMember(java.lang.String name, javax.xml.namespace.QName value)
void jsonMember(java.lang.String name, javax.xml.namespace.QName[] value)
void jsonMember(java.lang.String name, java.lang.String value)
void jsonMember(java.lang.String name, java.lang.String[] value)
void jsonMember(java.lang.String name, java.lang.String value, int off, int len)
void jsonNull()
void jsonNumber(byte value)
void jsonNumber(java.lang.Byte value)
void jsonNumber(double value)
void jsonNumber(java.lang.Double value)
void jsonNumber(float value)
void jsonNumber(java.lang.Float value)
void jsonNumber(int value)
void jsonNumber(java.lang.Integer value)
void jsonNumber(long value)
void jsonNumber(java.lang.Long value)
void jsonNumber(short value)
void jsonNumber(java.lang.Short value)
void jsonObject(java.lang.Object obj)
void jsonQName(javax.xml.namespace.QName value)
Writes a QNamejava.io.Writer jsonString()
Starts a JSON string and returns a writer that can be used to stream the content of the string.void jsonString(java.lang.String value)
void jsonString(java.lang.String value, int off, int len)
void value(java.lang.Boolean value)
void value(boolean[] value)
void value(java.lang.Boolean[] value)
void value(java.lang.Byte value)
void value(byte[] value)
void value(java.lang.Byte[] value)
void value(char[] cbuf)
void value(java.util.Collection<?> value)
void value(java.util.Date value)
Writes the date in JSON format according to the IETF standard (RFC 1123 Section 5.2.14 and elsewhere) date syntax: "Mon, 25 Dec 1995 13:30:00 GMT".void value(java.util.Date[] value)
Writes a sequence of dates in RFC 1123 format.void value(java.lang.Double value)
void value(double[] value)
void value(java.lang.Double[] value)
void value(java.lang.Float value)
void value(float[] value)
void value(java.lang.Float[] value)
void value(int[] value)
void value(java.lang.Integer value)
void value(java.lang.Integer[] value)
void value(java.util.Locale value)
Writes the locale in RFC 4646 formatvoid value(java.util.Locale[] value)
Writes a sequence of locales in RFC 4646 formatvoid value(java.lang.Long value)
void value(long[] value)
void value(java.lang.Long[] value)
void value(java.util.Map<java.lang.String,?> value)
void value(java.lang.Object value)
void value(java.lang.Object[] value)
void value(javax.xml.namespace.QName value)
void value(javax.xml.namespace.QName[] value)
void value(java.lang.Short value)
void value(short[] value)
void value(java.lang.Short[] value)
void value(java.lang.String value)
void value(java.lang.String[] value)
void value(java.lang.String value, int off, int len)
Methods inherited from interface com.ibm.portal.streaming.json.JsonContentHandlerEx processingInstruction
Methods inherited from interface com.ibm.portal.streaming.json.JsonContentHandler endArray, endBoolean, endDocument, endMember, endNull, endNumber, endObject, endString, startArray, startBoolean, startDocument, startMember, startNull, startNumber, startObject, startString, value, value, value, value
Method Detail getBase64OutputStream
java.io.OutputStream getBase64OutputStream() throws java.io.IOException
- OutputStream used to stream a string value encoded as base64, similar to the value(String) method. Make sure to close OutputStream.close() to complete writing the value to flush potential buffers.
- Returns:
- the writer that can be used to write the string.
- Throws:
- java.io.IOException
getInnerJsonContentHandler
DefaultJsonContentHandler getInnerJsonContentHandler()
- Returns a JsonContentHandler that ignores calls to JsonContentHandler.startDocument() and JsonContentHandler.endDocument() but simply passes on all other calls to the DefaultContentHandler. This inner content handler is convenient to embed a second JSON document into the document represented by the content handler.
- Returns:
- A JsonContentHandler implementation that ignores document start and end calls.
- Since:
- 8.0
getWriter
java.io.Writer getWriter() throws java.io.IOException
- Writer used to stream a string value, similar to the value(String) method. Make sure to close Writer.close() to complete writing the value to flush potential buffers.
- Returns:
- the writer that can be used to write the string.
- Throws:
- java.io.IOException
jsonArray
void jsonArray(boolean[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.lang.Boolean[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(byte[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.lang.Byte[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.util.Date[] value) throws java.io.IOException
- Writes an array of dates in RFC 1123 forma
- Parameters:
- value - the date array, may be null
- Throws:
- java.io.IOException
- Since:
- 8.0
jsonArray
void jsonArray(double[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.lang.Double[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(float[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.lang.Float[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(int[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.lang.Integer[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.util.Locale[] value) throws java.io.IOException
- Writes an array of locales in RFC 4646 format
- Parameters:
- value - the locale array, may be null
- Throws:
- java.io.IOException
- Since:
- 8.0
jsonArray
void jsonArray(long[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.lang.Long[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.lang.Object[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(javax.xml.namespace.QName[] value) throws java.io.IOException
- Writes an array of QName objects
- Parameters:
- value - the array of QName objects
- Throws:
- java.io.IOException
- Since:
- 8.0
jsonArray
void jsonArray(short[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.lang.Short[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonArray
void jsonArray(java.lang.String[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonBoolean
void jsonBoolean(boolean value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonBoolean
void jsonBoolean(java.lang.Boolean value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonCollection
void jsonCollection(java.util.Collection<?> value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonDate
void jsonDate(java.util.Date value) throws java.io.IOException
- Writes a date in RFC 1123 format
- Parameters:
- value - the date object, may be null
- Throws:
- java.io.IOException
- Since:
- 8.0
jsonDate
void jsonDate(long value) throws java.io.IOException
- Writes a date in RFC 1123 format
- Parameters:
- value - the number of milliseconds
- Throws:
- java.io.IOException
- Since:
- 8.0
jsonLocale
void jsonLocale(java.util.Locale value) throws java.io.IOException
- Writes a locale in RFC 4646 format
- Parameters:
- value - the locale, may be null
- Throws:
- java.io.IOException
- Since:
- 8.0
jsonMap
void jsonMap(java.util.Map<java.lang.String,?> value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, boolean value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Boolean value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, boolean[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Boolean[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.util.Collection<?> value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.util.Date value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.util.Date[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, double value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Double value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, double[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Double[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, float value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Float value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, float[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Float[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, int value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, int[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Integer value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Integer[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.util.Locale value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.util.Locale[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, long value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Long value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, long[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Long[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.util.Map<java.lang.String,?> value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Object value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.Object[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, javax.xml.namespace.QName value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, javax.xml.namespace.QName[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.String value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.String value, int off, int len) throws java.io.IOException
- Throws:
- java.io.IOException
jsonMember
void jsonMember(java.lang.String name, java.lang.String[] value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNull
void jsonNull() throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(byte value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(java.lang.Byte value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(double value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(java.lang.Double value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(float value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(java.lang.Float value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(int value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(java.lang.Integer value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(long value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(java.lang.Long value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(short value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonNumber
void jsonNumber(java.lang.Short value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonObject
void jsonObject(java.lang.Object obj) throws java.io.IOException
- Throws:
- java.io.IOException
jsonQName
void jsonQName(javax.xml.namespace.QName value) throws java.io.IOException
- Writes a QName
- Parameters:
- value - the QName object, may be null
- Throws:
- java.io.IOException
- Since:
- 8.0
jsonString
java.io.Writer jsonString() throws java.io.IOException
- Starts a JSON string and returns a writer that can be used to stream the content of the string. Make sure to call Writer.close() to finish writing.
- Returns:
- writer that represents the content of the string
- Throws:
- java.io.IOException
- Since:
- 8.0
jsonString
void jsonString(java.lang.String value) throws java.io.IOException
- Throws:
- java.io.IOException
jsonString
void jsonString(java.lang.String value, int off, int len) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Boolean value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(boolean[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Boolean[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Byte value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(byte[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Byte[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(char[] cbuf) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.util.Collection<?> value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.util.Date value) throws java.io.IOException
- Writes the date in JSON format according to the IETF standard (RFC 1123 Section 5.2.14 and elsewhere) date syntax: "Mon, 25 Dec 1995 13:30:00 GMT".
- Parameters:
- value - the date object, not null
- Throws:
- java.io.IOException
- Since:
- 8.0
value
void value(java.util.Date[] value) throws java.io.IOException
- Writes a sequence of dates in RFC 1123 format.
- Parameters:
- value - the date object array, not null
- Throws:
- java.io.IOException
- Since:
- 8.0
value
void value(java.lang.Double value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(double[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Double[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Float value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(float[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Float[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(int[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Integer value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Integer[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.util.Locale value) throws java.io.IOException
- Writes the locale in RFC 4646 format
- Parameters:
- value - the locale object, not null
- Throws:
- java.io.IOException
- Since:
- 8.0
value
void value(java.util.Locale[] value) throws java.io.IOException
- Writes a sequence of locales in RFC 4646 format
- Parameters:
- value - the locale object array, not null
- Throws:
- java.io.IOException
- Since:
- 8.0
value
void value(java.lang.Long value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(long[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Long[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.util.Map<java.lang.String,?> value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Object value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Object[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(javax.xml.namespace.QName value) throws java.io.IOException
- Throws:
- java.io.IOException
- Since:
- 8.0
value
void value(javax.xml.namespace.QName[] value) throws java.io.IOException
- Throws:
- java.io.IOException
- Since:
- 8.0
value
void value(java.lang.Short value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(short[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.Short[] value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.String value) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.String value, int off, int len) throws java.io.IOException
- Throws:
- java.io.IOException
value
void value(java.lang.String[] value) throws java.io.IOExceptionPREV CLASS NEXT CLASS
- Throws:
- java.io.IOException
Tree SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD