BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.apache.xerces.utils
Class ChunkyByteArray

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--weblogic.apache.xerces.utils.ChunkyByteArray

public final class ChunkyByteArray
extends java.io.InputStream

This class is used for accessing the data provided by an InputStream. There are two ways in which this class is used. The first occurs when we are prescanning the start of the stream to determine the encoding being used. Since we do not require that the stream be positionable, we wrap it with an instance of this class. The first "chunk" of the file is read and the data may be accessed directly using the byteAt(offset) method. After we have determined the encoding of the byte stream, the instance of this class is passed on to the EntityReader that will process the data for the scanner. At this point, the reader may continue to access this instance using the byteAt method, which will continue to read the contents into chunks as required until end of input. An example of this is the UCSReader. Alternatively, the reader may access this instance as an InputStream which will first return any data that has been reading into the chunks, and will then return the remaining data from the original InputStream directly.

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:
 

Constructor Summary
ChunkyByteArray(java.io.InputStream is)
          Constructor Reads the first chunk.
 
Method Summary
 boolean atEOF(int offset)
          Test to see if an offset is at the end of the input data.
 byte byteAt(int offset)
          Return a byte of input data at the given offset.
 void close()
          Closes this input Stream
 int read()
          Read a byte.
 int read(byte[] buffer, int offset, int length)
          Read bytes.
 void rewind()
          Reset position within the data stream back to the very beginning.
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkyByteArray

public ChunkyByteArray(java.io.InputStream is)
                throws java.io.IOException
Constructor Reads the first chunk.

Parameters:
is - The input stream containing the data of the entity.
Method Detail

read

public int read()
         throws java.io.IOException
Read a byte.

Returns:
The next byte of the input data or -1 if there is no more data.
Overrides:
read in class java.io.InputStream

read

public int read(byte[] buffer,
                int offset,
                int length)
         throws java.io.IOException
Read bytes.

Parameters:
buffer - The destination for the bytes returned. If null, then the data will discarded instead of returned.
offset - The offset within the buffer where the first returned byte should be placed.
length - The maximum number of bytes to place in the buffer or discard.
Returns:
The number of bytes actually placed in the buffer or discarded.
Overrides:
read in class java.io.InputStream

rewind

public void rewind()
Reset position within the data stream back to the very beginning.

byteAt

public byte byteAt(int offset)
            throws java.io.IOException
Return a byte of input data at the given offset.

Parameters:
offset - The offset in the data stream.
Returns:
The byte at the specified position within the data stream.

atEOF

public boolean atEOF(int offset)
Test to see if an offset is at the end of the input data.

Parameters:
offset - A position in the data stream.
Returns:
true if the position is at the end of the data stream; false otherwise.

close

public void close()
           throws java.io.IOException
Closes this input Stream

Throws:
java.io.IOException -  
Overrides:
close in class java.io.InputStream

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

WebLogic classes and methods that do not appear in this reference are not public and are not supported.