|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.apache.xerces.readers.XMLEntityReader | +--org.enhydra.apache.xerces.readers.UCSReader
Reader for UCS-2 and UCS-4 encodings.
This reader is created by the UCSRecognizer class when it decides that the byte stream is encoded in a format supported by this class. This class was intended to be another example of an encoding sensitive reader that could take advantage of the system design to improve performance and reduce resource consumption, but the actual performance tuning remains to be done.
Field Summary | |
(package private) static int |
E_UCS2B
|
(package private) static int |
E_UCS2B_NOBOM
|
(package private) static int |
E_UCS2L
|
(package private) static int |
E_UCS2L_NOBOM
|
(package private) static int |
E_UCS4B
|
(package private) static int |
E_UCS4L
|
protected int |
fCarriageReturnCounter
|
protected int |
fCharacterCounter
|
protected XMLEntityHandler.CharDataHandler |
fCharDataHandler
|
protected int |
fCurrentOffset
|
protected XMLEntityHandler |
fEntityHandler
|
protected XMLErrorReporter |
fErrorReporter
|
protected boolean |
fInCDSect
|
protected int |
fLinefeedCounter
|
protected boolean |
fSendCharDataAsCharArray
|
Constructor Summary | |
(package private) |
UCSReader(XMLEntityHandler entityHandler,
XMLErrorReporter errorReporter,
boolean sendCharDataAsCharArray,
ChunkyByteArray data,
int encoding,
StringPool stringPool)
|
Method Summary | |
int |
addString(int offset,
int length)
Add a string to the StringPool from the characters scanned using this
reader as described by offset and length . |
int |
addSymbol(int offset,
int length)
Add a symbol to the StringPool from the characters scanned using this
reader as described by offset and length . |
void |
append(XMLEntityHandler.CharBuffer charBuffer,
int offset,
int length)
Append the characters processed by this reader associated with offset and
length to the CharBuffer . |
void |
callCharDataHandler(int offset,
int length,
boolean isWhitespace)
|
protected XMLEntityHandler.EntityReader |
changeReaders()
This method is called by the reader subclasses at the end of input. |
int |
currentOffset()
Return the current offset within this reader. |
boolean |
equalsString(int offset,
int length,
char[] strChars,
int strOffset,
int strLength)
|
int |
getColumnNumber()
Return the column number of the current position within the document that we are processing. |
boolean |
getInCDSect()
This method is provided for scanner implementations. |
int |
getLineNumber()
Return the line number of the current position within the document that we are processing. |
protected void |
init(XMLEntityHandler entityHandler,
XMLErrorReporter errorReporter,
boolean sendCharDataAsCharArray,
int lineNumber,
int columnNumber)
|
boolean |
lookingAtChar(char ch,
boolean skipPastChar)
Test that the current character is a ch character. |
boolean |
lookingAtSpace(boolean skipPastChar)
Test that the current character is a whitespace character. |
boolean |
lookingAtValidChar(boolean skipPastChar)
Test that the current character is valid. |
void |
releaseString(int offset,
int length)
|
int |
scanAttValue(char qchar,
boolean asSymbol)
Scan an attribute value. |
int |
scanCharRef(boolean hex)
Scan a character reference. |
int |
scanContent(QName element)
Skip through the input while we are looking at character data. |
int |
scanEntityValue(int qchar,
boolean createString)
Scan an entity value. |
boolean |
scanExpectedName(char fastcheck,
StringPool.CharArrayRange expectedName)
Scan the name that is expected at the current position in the document. |
int |
scanInvalidChar()
Scan an invalid character. |
int |
scanName(char fastcheck)
Add a sequence of characters that match the XML definition of a Name to the StringPool .
|
void |
scanQName(char fastcheck,
QName qname)
Add a sequence of characters that match the XML Namespaces definition of a QName to the StringPool .
|
int |
scanStringLiteral()
Scan a string literal. |
void |
setInCDSect(boolean inCDSect)
This method is provided for scanner implementations. |
void |
skipPastName(char fastcheck)
Skip past a sequence of characters that match the XML definition of a Name. |
void |
skipPastNmtoken(char fastcheck)
Skip past a sequence of characters that match the XML definition of an Nmtoken. |
void |
skipPastSpaces()
Skip past whitespace characters starting at the current position. |
boolean |
skippedString(char[] s)
Skip past a sequence of characters that matches the specified character array. |
void |
skipToChar(char chr)
Advance through the input data up to the next ch character. |
String |
toString(int offset,
int length)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static final int E_UCS4B
static final int E_UCS4L
static final int E_UCS2B
static final int E_UCS2L
static final int E_UCS2B_NOBOM
static final int E_UCS2L_NOBOM
protected XMLEntityHandler fEntityHandler
protected XMLErrorReporter fErrorReporter
protected boolean fSendCharDataAsCharArray
protected XMLEntityHandler.CharDataHandler fCharDataHandler
protected boolean fInCDSect
protected int fCarriageReturnCounter
protected int fLinefeedCounter
protected int fCharacterCounter
protected int fCurrentOffset
Constructor Detail |
UCSReader(XMLEntityHandler entityHandler, XMLErrorReporter errorReporter, boolean sendCharDataAsCharArray, ChunkyByteArray data, int encoding, StringPool stringPool) throws Exception
Method Detail |
public int addString(int offset, int length)
XMLEntityHandler.EntityReader
StringPool
from the characters scanned using this
reader as described by offset
and length
.
addString
in interface XMLEntityHandler.EntityReader
offset
- The offset within this reader where the characters start.length
- The length within this reader where the characters end.
StringPool
handle for the string.public int addSymbol(int offset, int length)
XMLEntityHandler.EntityReader
StringPool
from the characters scanned using this
reader as described by offset
and length
.
addSymbol
in interface XMLEntityHandler.EntityReader
offset
- The offset within this reader where the characters start.length
- The length within this reader where the characters end.
StringPool
handle for the symbol.public void append(XMLEntityHandler.CharBuffer charBuffer, int offset, int length)
XMLEntityHandler.EntityReader
offset
and
length
to the CharBuffer
.
append
in interface XMLEntityHandler.EntityReader
charBuffer
- The CharBuffer
to append the characters to.offset
- The offset within this reader where the copy should start.length
- The length within this reader where the copy should stop.public void releaseString(int offset, int length)
releaseString
in interface StringPool.StringProducer
public String toString(int offset, int length)
toString
in interface StringPool.StringProducer
public boolean equalsString(int offset, int length, char[] strChars, int strOffset, int strLength)
equalsString
in interface StringPool.StringProducer
public void callCharDataHandler(int offset, int length, boolean isWhitespace) throws Exception
Exception
public boolean lookingAtChar(char ch, boolean skipPastChar) throws Exception
XMLEntityHandler.EntityReader
ch
character.
lookingAtChar
in interface XMLEntityHandler.EntityReader
ch
- The character to match against.skipPastChar
- If true
, we advance past the matched character.
true
if the current character is a ch
character;
false
otherwise.
Exception
public boolean lookingAtValidChar(boolean skipPastChar) throws Exception
XMLEntityHandler.EntityReader
lookingAtValidChar
in interface XMLEntityHandler.EntityReader
skipPastChar
- If true
, we advance past the valid character.
true
if the current character is valid;
false
otherwise.
Exception
public boolean lookingAtSpace(boolean skipPastChar) throws Exception
XMLEntityHandler.EntityReader
lookingAtSpace
in interface XMLEntityHandler.EntityReader
skipPastChar
- If true
, we advance past the whitespace character.
true
if the current character is whitespace;
false
otherwise.
Exception
public void skipToChar(char chr) throws Exception
XMLEntityHandler.EntityReader
ch
character.
skipToChar
in interface XMLEntityHandler.EntityReader
chr
- The character to search for.
Exception
public void skipPastSpaces() throws Exception
XMLEntityHandler.EntityReader
skipPastSpaces
in interface XMLEntityHandler.EntityReader
Exception
public void skipPastName(char fastcheck) throws Exception
XMLEntityHandler.EntityReader
skipPastName
in interface XMLEntityHandler.EntityReader
Exception
public void skipPastNmtoken(char fastcheck) throws Exception
XMLEntityHandler.EntityReader
skipPastNmtoken
in interface XMLEntityHandler.EntityReader
Exception
public boolean skippedString(char[] s) throws Exception
XMLEntityHandler.EntityReader
skippedString
in interface XMLEntityHandler.EntityReader
s
- The characters to match.
true
if the current character is valid;
false
otherwise.
Exception
public int scanInvalidChar() throws Exception
XMLEntityHandler.EntityReader
scanInvalidChar
in interface XMLEntityHandler.EntityReader
Exception
public int scanCharRef(boolean hex) throws Exception
XMLEntityHandler.EntityReader
scanCharRef
in interface XMLEntityHandler.EntityReader
Exception
public int scanStringLiteral() throws Exception
XMLEntityHandler.EntityReader
scanStringLiteral
in interface XMLEntityHandler.EntityReader
StringPool
handle for the string that
was scanned, or one of the following error codes:
STRINGLIT_RESULT_QUOTE_REQUIRED
STRINGLIT_RESULT_INVALID_CHAR
Exception
public int scanAttValue(char qchar, boolean asSymbol) throws Exception
XMLEntityHandler.EntityReader
scanAttValue
in interface XMLEntityHandler.EntityReader
qchar
- The initial quote character, either a single or double quote.
StringPool
handle for the string that
was scanned, or one of the following error codes:
ATTVALUE_RESULT_COMPLEX
ATTVALUE_RESULT_LESSTHAN
ATTVALUE_RESULT_INVALID_CHAR
Exception
public int scanEntityValue(int qchar, boolean createString) throws Exception
XMLEntityHandler.EntityReader
scanEntityValue
in interface XMLEntityHandler.EntityReader
qchar
- The initial quote character, either a single or double quote.
StringPool
handle for the string that
was scanned, or one of the following error codes:
ENTITYVALUE_RESULT_FINISHED
ENTITYVALUE_RESULT_REFERENCE
ENTITYVALUE_RESULT_PEREF
ENTITYVALUE_RESULT_INVALID_CHAR
ENTITYVALUE_RESULT_END_OF_INPUT
Exception
public boolean scanExpectedName(char fastcheck, StringPool.CharArrayRange expectedName) throws Exception
XMLEntityHandler.EntityReader
scanExpectedName
in interface XMLEntityHandler.EntityReader
fastcheck
- A character that is not a legal name character that is provided as a
hint to the reader of a character likely to terminate the Name.expectedName
- The characters of the name we expect.
true
if we scanned the name we expected to find; otherwise
false
if we did not.
Exception
public void scanQName(char fastcheck, QName qname) throws Exception
XMLEntityHandler.EntityReader
StringPool
.
If we find a QName at the current position we will add it to the StringPool
and will return the string pool handle of that QName to the caller.
scanQName
in interface XMLEntityHandler.EntityReader
fastcheck
- A character that is not a legal name character that is provided as a
hint to the reader of a character likely to terminate the Name.
Exception
public int scanName(char fastcheck) throws Exception
XMLEntityHandler.EntityReader
StringPool
.
If we find a name at the current position we will add it to the StringPool
as a symbol and will return the string pool handle for that symbol to the caller.
scanName
in interface XMLEntityHandler.EntityReader
fastcheck
- A character that is not a legal name character that is provided as a
hint to the reader of a character likely to terminate the Name.
StringPool
handle for the name that was scanned,
or -1 if a name was not found at the current position within the input data.
Exception
public int scanContent(QName element) throws Exception
XMLEntityHandler.EntityReader
scanContent
in interface XMLEntityHandler.EntityReader
Exception
protected void init(XMLEntityHandler entityHandler, XMLErrorReporter errorReporter, boolean sendCharDataAsCharArray, int lineNumber, int columnNumber)
public int currentOffset()
currentOffset
in interface XMLEntityHandler.EntityReader
public int getLineNumber()
getLineNumber
in interface XMLEntityHandler.EntityReader
public int getColumnNumber()
getColumnNumber
in interface XMLEntityHandler.EntityReader
public void setInCDSect(boolean inCDSect)
setInCDSect
in interface XMLEntityHandler.EntityReader
public boolean getInCDSect()
getInCDSect
in interface XMLEntityHandler.EntityReader
protected XMLEntityHandler.EntityReader changeReaders() throws Exception
Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |