org.apache.vinci.transport.document
Class XTalkToSAX

java.lang.Object
  extended by org.apache.vinci.transport.document.XTalkToSAX

public class XTalkToSAX
extends java.lang.Object

Class for converting XTalk streams into SAX events.


Field Summary
static int INITIAL_BUF_SIZE
           
 
Constructor Summary
XTalkToSAX()
           
XTalkToSAX(int bufSize)
           
 
Method Summary
 int bufferSize()
          Initially, the XTalkToSAX processor creates a byte buffer and char buffer of size INITIAL_BUF_SIZE.
 void parse(java.io.InputStream is, org.xml.sax.ContentHandler handler)
          Parse one document off of the incoming XTalk stream into SAX events.
 void resizeBuffers(int toSize)
          Resets buffers to their initial size...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_BUF_SIZE

public static final int INITIAL_BUF_SIZE
See Also:
Constant Field Values
Constructor Detail

XTalkToSAX

public XTalkToSAX()

XTalkToSAX

public XTalkToSAX(int bufSize)
Method Detail

bufferSize

public int bufferSize()
Initially, the XTalkToSAX processor creates a byte buffer and char buffer of size INITIAL_BUF_SIZE. These buffer may grow during parsing to handle very large strings. Users can determine the size of these arrays with this method. This method in conjunction with resetBuffers lets application implement their own buffer management. Buffers can be reset during parsing, but not from another thread.


resizeBuffers

public void resizeBuffers(int toSize)
Resets buffers to their initial size... this is useful because buffers can grow during parsing and this allows the space to be reclaimed without having to undo references to the parser object.


parse

public void parse(java.io.InputStream is,
                  org.xml.sax.ContentHandler handler)
           throws java.io.IOException,
                  org.xml.sax.SAXException
Parse one document off of the incoming XTalk stream into SAX events. A side effect of parsing is that internal arrays will grow to the size of the largest character string encountered in the document. Use bufferSize() and resizeBuffers to manage memory in applications where very large strings may be encountered and the same object is used to parse many incoming documents.

Throws:
java.io.IOException - if underlying IOException from the stream or if XTalk format is invalid.
org.xml.sax.SAXException - if SAXException thrown by the handler


Copyright © 2011. All Rights Reserved.