Xerces-J API: Class StreamingCharReader

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xerces.readers
Class StreamingCharReader

    java.lang.Object
      |
      +--org.apache.xerces.readers.XMLEntityReader
            |
            +--org.apache.xerces.readers.StreamingCharReader

public class StreamingCharReader
extends org.apache.xerces.readers.XMLEntityReader

An reader class for applications that need to process input data as it arrives on the stream.

Version:
  $Id: StreamingCharReader.java,v 1.5 2001/02/01 09:58:22 andyc Exp $

Field Summary
`protected boolean` | `fCalledCharPropInit`
`protected java.io.Reader` | `fCharacterStream`
`protected CharDataChunk` | `fCurrentChunk`
`protected int` | `fCurrentIndex`
`protected int` | `fFillIndex`
`protected int` | `fLength`
`protected int` | `fMostRecentChar`
`protected char[]` | `fMostRecentData`

Fields inherited from class org.apache.xerces.readers.XMLEntityReader
`fCarriageReturnCounter, fCharacterCounter, fCharDataHandler, fCurrentOffset, fEntityHandler, fErrorReporter, fInCDSect, fLinefeedCounter, fSendCharDataAsCharArray`

Constructor Summary
`StreamingCharReader(XMLEntityHandler entityHandler, XMLErrorReporter errorReporter, boolean sendCharDataAsCharArray, java.io.Reader reader, StringPool stringPool)` Constructor

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`.
`protected XMLEntityHandler.EntityReader` | `changeReaders()` Change readers at end of input.
`protected void` | `deferException(int errorCode, java.lang.Object[] args, int offset)` Delay reporting an error message.
`boolean` | `lookingAtChar(char chr, 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.
`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` | `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.

Methods inherited from class org.apache.xerces.readers.XMLEntityReader
`currentOffset, getColumnNumber, getInCDSect, getLineNumber, init, setInCDSect`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### fCharacterStream

    protected java.io.Reader fCharacterStream

### fCurrentChunk

    protected CharDataChunk fCurrentChunk

### fCurrentIndex

    protected int fCurrentIndex

### fFillIndex

    protected int fFillIndex

### fMostRecentData

    protected char[] fMostRecentData

### fMostRecentChar

    protected int fMostRecentChar

### fLength

    protected int fLength

### fCalledCharPropInit

    protected boolean fCalledCharPropInit

Constructor Detail

### StreamingCharReader

    public StreamingCharReader(XMLEntityHandler entityHandler,
                               XMLErrorReporter errorReporter,
                               boolean sendCharDataAsCharArray,
                               java.io.Reader reader,
                               StringPool stringPool)
                        throws java.lang.Exception

  Constructor
  Parameters:
    `entityHandler` - The entity handler.
    `errorReporter` - The error reporter.
    `sendCharDataAsCharArray` - true if char data should be reported using char arrays instead of string handles.
    `stringPool` - The string pool.

Method Detail

### deferException

    protected void deferException(int errorCode,
                                  java.lang.Object[] args,
                                  int offset)

  Delay reporting an error message. If there is an error detected in the underlying input stream during the fillCurrentChunk method, the error is described here and will be reported when we reach that offset during normal processing. The subclass should place a character with a value of zero at that offset, which will be detected here as an invalid character. When the invalid character is scanned, we will generate the deferred exception.
  Parameters:
    `errorCode` - the errorCode to report
    `args` - an array of arguments needed to generate a good error message
    `offset` - the position in the reader where the error occured

### changeReaders

    protected XMLEntityHandler.EntityReader changeReaders()
                                                   throws java.lang.Exception

  Change readers at end of input. We override our superclass method to release the final chunk of the input data before handing off to the next reader.
  Overrides:
    changeReaders in class org.apache.xerces.readers.XMLEntityReader
  Returns:
    The next reader used to continue processing the document.

### append

    public void append(XMLEntityHandler.CharBuffer charBuffer,
                       int offset,
                       int length)

  Append the characters processed by this reader associated with `offset` and `length` to the `CharBuffer`.
  Parameters:
    `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.

### addString

    public 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`.
  Parameters:
    `offset` - The offset within this reader where the characters start.
    `length` - The length within this reader where the characters end.
  Returns:
    The `StringPool` handle for the string.

### addSymbol

    public 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`.
  Parameters:
    `offset` - The offset within this reader where the characters start.
    `length` - The length within this reader where the characters end.
  Returns:
    The `StringPool` handle for the symbol.

### lookingAtChar

    public boolean lookingAtChar(char chr,
                                 boolean skipPastChar)
                          throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Test that the current character is a `ch` character.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `ch` - The character to match against.
    `skipPastChar` - If `true`, we advance past the matched character.
  Returns:
    `true` if the current character is a `ch` character; `false` otherwise.
  Throws:
    java.lang.Exception -

### lookingAtValidChar

    public boolean lookingAtValidChar(boolean skipPastChar)
                               throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Test that the current character is valid.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `skipPastChar` - If `true`, we advance past the valid character.
  Returns:
    `true` if the current character is valid; `false` otherwise.
  Throws:
    java.lang.Exception -

### lookingAtSpace

    public boolean lookingAtSpace(boolean skipPastChar)
                           throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Test that the current character is a whitespace character.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `skipPastChar` - If `true`, we advance past the whitespace character.
  Returns:
    `true` if the current character is whitespace; `false` otherwise.
  Throws:
    java.lang.Exception -

### skipToChar

    public void skipToChar(char chr)
                    throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Advance through the input data up to the next `ch` character.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `ch` - The character to search for.
  Throws:
    java.lang.Exception -

### skipPastSpaces

    public void skipPastSpaces()
                        throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Skip past whitespace characters starting at the current position.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Throws:
    java.lang.Exception -

### skipPastName

    public void skipPastName(char fastcheck)
                      throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Skip past a sequence of characters that match the XML definition of a Name.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Throws:
    java.lang.Exception -

### skipPastNmtoken

    public void skipPastNmtoken(char fastcheck)
                         throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Skip past a sequence of characters that match the XML definition of an Nmtoken.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Throws:
    java.lang.Exception -

### skippedString

    public boolean skippedString(char[] s)
                          throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Skip past a sequence of characters that matches the specified character array.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `s` - The characters to match.
  Returns:
    `true` if the current character is valid; `false` otherwise.
  Throws:
    java.lang.Exception -

### scanInvalidChar

    public int scanInvalidChar()
                        throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Scan an invalid character.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Returns:
    The invalid character as an integer, or -1 if there was a bad encoding.
  Throws:
    java.lang.Exception -

### scanCharRef

    public int scanCharRef(boolean hex)
                    throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Scan a character reference.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Returns:
    The value of the character, or one of the following error codes: CHARREF_RESULT_SEMICOLON_REQUIRED CHARREF_RESULT_INVALID_CHAR CHARREF_RESULT_OUT_OF_RANGE
  Throws:
    java.lang.Exception -

### scanStringLiteral

    public int scanStringLiteral()
                          throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Scan a string literal.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Returns:
    The `StringPool` handle for the string that was scanned, or one of the following error codes: STRINGLIT_RESULT_QUOTE_REQUIRED STRINGLIT_RESULT_INVALID_CHAR
  Throws:
    java.lang.Exception -

### scanAttValue

    public int scanAttValue(char qchar,
                            boolean asSymbol)
                     throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Scan an attribute value.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `qchar` - The initial quote character, either a single or double quote.
  Returns:
    The `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
  Throws:
    java.lang.Exception -

### scanEntityValue

    public int scanEntityValue(int qchar,
                               boolean createString)
                        throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Scan an entity value.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `qchar` - The initial quote character, either a single or double quote.
  Returns:
    The `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
  Throws:
    java.lang.Exception -

### scanName

    public int scanName(char fastcheck)
                 throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Add a sequence of characters that match the XML definition of a Name to the `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.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `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.
  Returns:
    The `StringPool` handle for the name that was scanned, or -1 if a name was not found at the current position within the input data.
  Throws:
    java.lang.Exception -

### scanExpectedName

    public boolean scanExpectedName(char fastcheck,
                                    StringPool.CharArrayRange expectedName)
                             throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Scan the name that is expected at the current position in the document. This method is invoked when we are scanning the element type in an end tag that must match the element type in the corresponding start tag.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `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.
  Returns:
    `true` if we scanned the name we expected to find; otherwise `false` if we did not.
  Throws:
    java.lang.Exception -

### scanQName

    public void scanQName(char fastcheck,
                          QName qname)
                   throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Add a sequence of characters that match the XML Namespaces definition of a QName to the `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.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `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.
  Throws:
    java.lang.Exception -

### scanContent

    public int scanContent(QName element)
                    throws java.lang.Exception

  Description copied from interface: XMLEntityHandler.EntityReader
  Skip through the input while we are looking at character data.
  Tags copied from interface: XMLEntityHandler.EntityReader
  Parameters:
    `elementType` - The element type handle in the StringPool.
  Returns:
    One of the following result codes: CONTENT_RESULT_START_OF_PI CONTENT_RESULT_START_OF_COMMENT CONTENT_RESULT_START_OF_CDSECT CONTENT_RESULT_END_OF_CDSECT CONTENT_RESULT_START_OF_ETAG CONTENT_RESULT_MATCHING_ETAG CONTENT_RESULT_START_OF_ELEMENT CONTENT_RESULT_START_OF_CHARREF CONTENT_RESULT_START_OF_ENTITYREF CONTENT_RESULT_INVALID_CHAR CONTENT_RESULT_MARKUP_NOT_RECOGNIZED CONTENT_RESULT_MARKUP_END_OF_INPUT CONTENT_RESULT_REFERENCE_END_OF_INPUT
  Throws:
    java.lang.Exception -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2001 Apache XML Project. All Rights Reserved.