Class XTalkToSAX
- java.lang.Object
-
- org.apache.vinci.transport.document.XTalkToSAX
-
public class XTalkToSAX extends java.lang.ObjectClass for converting XTalk streams into SAX events.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]byteBufferprivate static java.lang.StringcdataTypeprivate char[]charBufferprivate org.xml.sax.ContentHandlerhandlerstatic intINITIAL_BUF_SIZEprivate java.io.InputStreamisprivate org.xml.sax.helpers.AttributesImplworkAttributes
-
Constructor Summary
Constructors Constructor Description XTalkToSAX()XTalkToSAX(int bufSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intbufferSize()Initially, the XTalkToSAX processor creates a byte buffer and char buffer of size INITIAL_BUF_SIZE.private java.lang.StringconsumeString()private voiddoElement()private voiddoProcessingInstruction()private voiddoTopLevelParse()private voidensureCapacity(int bytesToRead)private voidinit(int bufSize)voidparse(java.io.InputStream is, org.xml.sax.ContentHandler handler)Parse one document off of the incoming XTalk stream into SAX events.voidresizeBuffers(int toSize)Resets buffers to their initial size...
-
-
-
Field Detail
-
INITIAL_BUF_SIZE
public static final int INITIAL_BUF_SIZE
- See Also:
- Constant Field Values
-
cdataType
private static final java.lang.String cdataType
- See Also:
- Constant Field Values
-
charBuffer
private char[] charBuffer
-
byteBuffer
private byte[] byteBuffer
-
workAttributes
private org.xml.sax.helpers.AttributesImpl workAttributes
-
is
private java.io.InputStream is
-
handler
private org.xml.sax.ContentHandler handler
-
-
Method Detail
-
init
private void init(int bufSize)
-
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.- Returns:
- -
-
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.- Parameters:
toSize- -
-
parse
public void parse(java.io.InputStream is, org.xml.sax.ContentHandler handler) throws java.io.IOException, org.xml.sax.SAXExceptionParse 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.- Parameters:
is- -handler- -- 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
-
doTopLevelParse
private void doTopLevelParse() throws java.io.IOException, org.xml.sax.SAXException- Throws:
java.io.IOExceptionorg.xml.sax.SAXException
-
doProcessingInstruction
private void doProcessingInstruction() throws java.io.IOException, org.xml.sax.SAXException- Throws:
java.io.IOExceptionorg.xml.sax.SAXException
-
ensureCapacity
private void ensureCapacity(int bytesToRead)
-
consumeString
private java.lang.String consumeString() throws java.io.IOException- Throws:
java.io.IOException
-
doElement
private void doElement() throws java.io.IOException, org.xml.sax.SAXException- Throws:
java.io.IOExceptionorg.xml.sax.SAXException
-
-