|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.xbis.XBISReader
XML Binary Information Set input handler. This reads a compact representation of the data in an XML document, with the advantages of reduced document size and lower processing overhead as compared to the standard text document representation.
This class provides basic input handling, but the driver methods for reading the serial form and constructing the corresponding document representation must be implemented by a subclass specific to the representation used. The serial form is itself independent of the original representation, and may be read by the input handlers for representations other than the one from which it was generated.
| Nested Class Summary | |
static class |
XBISReader.CharBlock
Data block describing a block of characters. |
| Field Summary | |
static int |
DEFAULT_BUFFER_SIZE
Default size of input buffer. |
static int |
INITIAL_HANDLE_SIZE
Initial size of handle value arrays. |
static int |
INITIAL_STRING_SIZE
Initial size of String buffer (must be larger than short limit). |
protected int |
m_attrValueCount
Number of attribute handle value Strings currently defined. |
protected java.lang.String[] |
m_attrValueTable
Table of Strings corresponding to attribute handle values (created when needed). |
static int |
SHORT_STRING_LIMIT
Limit for reading String data a byte at a time. |
| Constructor Summary | |
XBISReader()
Constructor. |
|
| Method Summary | |
protected void |
activateNamespace(java.lang.Object ns)
Activate a namespace. |
protected int |
addNamespace(java.lang.Object ns)
Add namespace definition to table. |
protected int |
addNamespaceURI(java.lang.String uri)
Add namespace URI definition to table. |
protected abstract java.lang.Object |
buildName(java.lang.Object ns,
java.lang.String local)
Build name instance. |
protected abstract java.lang.Object |
buildNamespace(java.lang.String prefix,
java.lang.String uri)
Build namespace instance. |
protected void |
clearArray(int count,
java.lang.Object[] array)
Clears an array of Objects. |
protected void |
clearReset()
Clear reset state. |
protected void |
declareNamespace(java.lang.Object obj)
Declare namespace. |
protected char[][] |
doubleArray(char[][] base)
Doubles the size of an array of char[] values. |
protected java.lang.Object[] |
doubleArray(java.lang.Object[] base)
Doubles the size of an array of Object values. |
protected java.lang.String[] |
doubleArray(java.lang.String[] base)
Doubles the size of an array of String values. |
int |
getBytesRemaining()
Get bytes remaining in buffer **TESTING ONLY**. |
protected abstract void |
initState()
Initialize state information used during the serialization process. |
protected boolean |
isEnd()
Checks if end of input reached. |
protected boolean |
isReset()
Check reset state. |
protected int |
readByte()
Read next byte from buffer. |
protected char[] |
readChars(int length)
Read string of characters from stream. |
protected char[] |
readCharsDef(int lead)
Read reusable text node from stream. |
protected java.lang.Object |
readNamespaceDecl(int initial)
Read namespace declaration from stream. |
protected java.lang.Object |
readNamespaceDef()
Read namespace definition from stream. |
protected java.lang.Object |
readNamespaceRef(int initial,
int mask)
Read active namespace reference from stream. |
protected java.lang.String |
readPlainText(int lead)
Read plain text node from stream. |
protected java.lang.Object |
readQuickAttribute(int initial)
Read attribute name definition from stream with partial lead byte. |
protected java.lang.Object |
readQuickElement(int initial)
Read element name definition from stream with partial lead byte. |
protected int |
readQuickValue(int initial,
int mask)
Read non-negative integer value with partial lead byte from stream. |
protected java.lang.String |
readString()
Read String directly from stream. |
protected XBISReader.CharBlock |
readStringChars()
Read characters in a string directly from stream. |
protected java.lang.String |
readStringData(int length)
Read String data from stream. |
protected java.lang.String |
readStringDef(int lead)
Read reusable text node from stream. |
protected XBISReader.CharBlock |
readTextChars(int lead)
Read characters in a plain text node directly from stream. |
protected int |
readValue()
Read non-negative integer value from stream. |
void |
reset()
Reset state information used during the serialization process. |
int |
setStream(java.io.InputStream is)
Set input stream. |
protected void |
undeclareNamespace()
Undeclare namespace. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int DEFAULT_BUFFER_SIZE
public static final int INITIAL_HANDLE_SIZE
public static final int SHORT_STRING_LIMIT
public static final int INITIAL_STRING_SIZE
protected java.lang.String[] m_attrValueTable
protected int m_attrValueCount
| Constructor Detail |
public XBISReader()
| Method Detail |
protected final java.lang.Object[] doubleArray(java.lang.Object[] base)
Object values. Constructs
and returns the resized array, copying values from the old array across
to the new one.
base - array to be resized
protected final char[][] doubleArray(char[][] base)
char[] values. Constructs
and returns the resized array, copying values from the old array across
to the new one.
base - array to be resized
protected final java.lang.String[] doubleArray(java.lang.String[] base)
String values. Constructs
and returns the resized array, copying values from the old array across
to the new one.
base - array to be resized
protected final void clearArray(int count,
java.lang.Object[] array)
Objects.
count - number of references present in arrayarray - array to be cleared (may be null)
public int setStream(java.io.InputStream is)
throws java.io.IOException
is - serialization input stream
java.io.IOException - on error reading from streampublic final int getBytesRemaining()
protected final boolean isEnd()
throws java.io.IOException
true if end of input, false if data
remaining
java.io.IOException - on error reading from stream
protected final int readByte()
throws java.io.IOException
java.io.IOException - on error reading from stream
protected final int readValue()
throws java.io.IOException
java.io.IOException - on error reading from stream
protected final int readQuickValue(int initial,
int mask)
throws java.io.IOException
initial - byte containing value or continuationmask - value mask within first byte (right justified)
java.io.IOException - on error reading from stream
protected final char[] readChars(int length)
throws java.io.IOException
length - number of characters to read
java.io.IOException - on error reading from stream
protected final java.lang.String readStringData(int length)
throws java.io.IOException
String data from stream. Just uses readChars(int)
to read the characters, then turns them into a string to be returned.
length - number of character to read
java.io.IOException - on error reading from stream
protected final XBISReader.CharBlock readStringChars()
throws java.io.IOException
null string), in the standard integer value encoding,
followed by the specified number of characters. Character data uses a
separate encoding scheme. It is an error if this method is called for a
null string.
java.io.IOException - on error reading from streamreadChars(int)
protected final java.lang.String readString()
throws java.io.IOException
String directly from stream. This handles decoding of
the String value representation used in the serial form,
consisting of a leading character count plus one (with the value zero
used to indicate a null String), in the
standard integer value encoding, followed by the specified number of
characters. Character data uses a separate encoding scheme.
null)
java.io.IOException - on error reading from streamreadStringData(int)
protected final XBISReader.CharBlock readTextChars(int lead)
throws java.io.IOException
String.
lead - node definition byte
java.io.IOException - on error reading from streamreadChars(int)
protected final java.lang.String readPlainText(int lead)
throws java.io.IOException
String.
lead - node definition byte
java.io.IOException - on error reading from streamreadStringData(int)
protected final char[] readCharsDef(int lead)
throws java.io.IOException
lead - node definition byte
java.io.IOException - on error reading from stream
protected final java.lang.String readStringDef(int lead)
throws java.io.IOException
String with that handle. Otherwise, it
reads a String definition, assigning it the next consecutive
handle.
lead - node definition byte
java.io.IOException - on error reading from streamprotected final int addNamespace(java.lang.Object ns)
ns - namespace information
protected final int addNamespaceURI(java.lang.String uri)
uri - namespace URI
protected void activateNamespace(java.lang.Object ns)
throws XBISException
ns - namespace to be activated
XBISException - on error in processing XML data
protected final java.lang.Object readNamespaceDef()
throws java.io.IOException,
XBISException
java.io.IOException - on error reading from stream
XBISException - on error in processing XML data
protected final java.lang.Object readNamespaceDecl(int initial)
throws java.io.IOException,
XBISException
initial - byte containing handle or continuation
java.io.IOException - on error reading from stream
XBISException - on error in processing XML data
protected final java.lang.Object readNamespaceRef(int initial,
int mask)
throws java.io.IOException,
XBISException
initial - byte containing handle or continuationmask - value mask within first byte (right justified)
java.io.IOException - on error reading from stream
XBISException - on error in processing XML data
protected final java.lang.Object readQuickAttribute(int initial)
throws java.io.IOException,
XBISException
initial - byte containing value or continuation
java.io.IOException - on error reading from stream
XBISException - on error in processing XML data
protected final java.lang.Object readQuickElement(int initial)
throws java.io.IOException,
XBISException
initial - byte containing value or continuation
java.io.IOException - on error reading from stream
XBISException - on error in processing XML dataprotected void clearReset()
protected boolean isReset()
true if reset, false if notpublic void reset()
protected abstract void initState()
protected abstract java.lang.Object buildNamespace(java.lang.String prefix,
java.lang.String uri)
prefix - namespace prefixuri - namespace URI
protected void declareNamespace(java.lang.Object obj)
throws XBISException
obj - namespace object
XBISException - on error in processing XML dataprotected void undeclareNamespace()
protected abstract java.lang.Object buildName(java.lang.Object ns,
java.lang.String local)
ns - namespace for namelocal - local name
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||