BEA Systems, Inc.


weblogic.apache.xerces.readers
Class StreamingCharReader

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

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

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

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

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 weblogic.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)
           
 boolean lookingAtSpace(boolean skipPastChar)
           
 boolean lookingAtValidChar(boolean skipPastChar)
           
 int scanAttValue(char qchar, boolean asSymbol)
           
 int scanCharRef(boolean hex)
           
 int scanContent(QName element)
           
 int scanEntityValue(int qchar, boolean createString)
           
 boolean scanExpectedName(char fastcheck, StringPool.CharArrayRange expectedName)
           
 int scanInvalidChar()
           
 int scanName(char fastcheck)
           
 void scanQName(char fastcheck, QName qname)
           
 int scanStringLiteral()
           
 void skipPastName(char fastcheck)
           
 void skipPastNmtoken(char fastcheck)
           
 void skipPastSpaces()
           
 boolean skippedString(char[] s)
           
 void skipToChar(char chr)
           
 
Methods inherited from class weblogic.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.

Returns:
The next reader used to continue processing the document.
Overrides:
changeReaders in class weblogic.apache.xerces.readers.XMLEntityReader

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

lookingAtValidChar

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

lookingAtSpace

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

skipToChar

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

skipPastSpaces

public void skipPastSpaces()
                    throws java.lang.Exception

skipPastName

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

skipPastNmtoken

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

skippedString

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

scanInvalidChar

public int scanInvalidChar()
                    throws java.lang.Exception

scanCharRef

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

scanStringLiteral

public int scanStringLiteral()
                      throws java.lang.Exception

scanAttValue

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

scanEntityValue

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

scanName

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

scanExpectedName

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

scanQName

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

scanContent

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

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs70

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference