com.ibm.portal.streaming.json
Class JsonParserWriter

java.lang.Object
  extended by java.io.Writer
      extended by com.ibm.portal.streaming.json.JsonParserWriter
All Implemented Interfaces:
JsonContentHandlerProvider, JsonStream, java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.nio.channels.Channel

public abstract class JsonParserWriter
extends java.io.Writer
implements JsonContentHandlerProvider, java.nio.channels.Channel, JsonStream

Parser that decomposes a JSON stream into callbacks to JsonContentHandler. The JSON content to be parsed is written onto the parser using the Writer methods. The writer must be closed via Closeable.close() to complete the event sequence. New content can be parsed by reinitializing the parser using the reset() method. The parser will parse a sequence of JSON objects and generates JsonContentHandler.startDocument() and JsonContentHandler.endDocument() callbacks for each detected object in the stream. All content between JSON objects is considered garbage and will not be communicated to the handler.


Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Fields inherited from interface com.ibm.portal.streaming.json.JsonStream
CONTENT_TYPE_JSON
 
Constructor Summary
JsonParserWriter()
           
 
Method Summary
abstract  void reset()
          Reinitialize the parsing process
abstract  void setJsonContentHandler(JsonContentHandler handler)
          Associates the JsonContentHandler that receives the events of the parsing process
 
Methods inherited from class java.io.Writer
append, append, append, close, flush, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.portal.streaming.json.JsonContentHandlerProvider
getJsonContentHandler
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 

Constructor Detail

JsonParserWriter

public JsonParserWriter()
Method Detail

reset

public abstract void reset()
                    throws java.io.IOException
Reinitialize the parsing process

Throws:
java.io.IOException

setJsonContentHandler

public abstract void setJsonContentHandler(JsonContentHandler handler)
Associates the JsonContentHandler that receives the events of the parsing process

Specified by:
setJsonContentHandler in interface JsonContentHandlerProvider
Parameters:
handler - handler to receive the events
See Also:
JsonContentHandlerProvider.getJsonContentHandler()