Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.impl.jdbc
Class UTF8Reader  view UTF8Reader download UTF8Reader.java

java.lang.Object
  extended byjava.io.Reader
      extended byorg.apache.derby.impl.jdbc.UTF8Reader

public final class UTF8Reader
extends java.io.Reader


Field Summary
private  char[] buffer
           
private  int charactersInBuffer
           
private  java.io.InputStream in
           
private  long maxFieldSize
           
private  boolean noMoreReads
           
private  ConnectionChild parent
           
private  long readerCharCount
           
private  int readPositionInBuffer
           
private  long utfCount
           
private  long utfLen
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
UTF8Reader(java.io.InputStream in, long maxFieldSize, ConnectionChild parent, java.lang.Object synchronization)
           
 
Method Summary
 void close()
          Closes the stream.
private  void closeIn()
           
private  boolean fillBuffer()
          Fill the buffer, return true if eof has been reached.
 int read()
          Reads an char from the input stream and returns it as an int in the range of 0-65535.
 int read(char[] cbuf, int off, int len)
          Read chars from a stream and stores them into a caller supplied buffer.
(package private)  int readAsciiInto(byte[] abuf, int off, int len)
           
 int readInto(java.lang.StringBuffer sb, int len)
           
private  int readUnsignedShort()
           
 long skip(long len)
          Skips the specified number of chars in the stream.
private  java.io.IOException utfFormatException()
           
private  java.io.IOException utfFormatException(java.lang.String s)
           
 
Methods inherited from class java.io.Reader
mark, markSupported, read, ready, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

private java.io.InputStream in

utfLen

private final long utfLen

utfCount

private long utfCount

readerCharCount

private long readerCharCount

maxFieldSize

private long maxFieldSize

buffer

private char[] buffer

charactersInBuffer

private int charactersInBuffer

readPositionInBuffer

private int readPositionInBuffer

noMoreReads

private boolean noMoreReads

parent

private ConnectionChild parent
Constructor Detail

UTF8Reader

public UTF8Reader(java.io.InputStream in,
                  long maxFieldSize,
                  ConnectionChild parent,
                  java.lang.Object synchronization)
           throws java.io.IOException
Method Detail

read

public int read()
         throws java.io.IOException
Description copied from class: java.io.Reader
Reads an char from the input stream and returns it as an int in the range of 0-65535. This method also will return -1 if the end of the stream has been reached.

This method will block until the char can be read.


read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Description copied from class: java.io.Reader
Read chars from a stream and stores them into a caller supplied buffer. It starts storing the data at index offset into the buffer and attempts to read len chars. This method can return before reading the number of chars requested. The actual number of chars read is returned as an int. A -1 is returned to indicate the end of the stream.

This method will block until some data can be read.

This method operates by calling the single char read() method in a loop until the desired number of chars are read. The read loop stops short if the end of the stream is encountered or if an IOException is encountered on any read operation except the first. If the first attempt to read a chars fails, the IOException is allowed to propagate upward. And subsequent IOException is caught and treated identically to an end of stream condition. Subclasses can (and should if possible) override this method to provide a more efficient implementation.


skip

public long skip(long len)
          throws java.io.IOException
Description copied from class: java.io.Reader
Skips the specified number of chars in the stream. It returns the actual number of chars skipped, which may be less than the requested amount.

This method reads and discards chars into a 256 char array until the specified number of chars were skipped or until either the end of stream is reached or a read attempt returns a short count. Subclasses can override this method to provide a more efficient implementation where one exists.


close

public void close()
Description copied from class: java.io.Reader
Closes the stream. Any futher attempts to read from the stream may generate an IOException.


readInto

public int readInto(java.lang.StringBuffer sb,
                    int len)
             throws java.io.IOException

readAsciiInto

int readAsciiInto(byte[] abuf,
                  int off,
                  int len)
            throws java.io.IOException

closeIn

private void closeIn()

utfFormatException

private java.io.IOException utfFormatException(java.lang.String s)

utfFormatException

private java.io.IOException utfFormatException()

fillBuffer

private boolean fillBuffer()
                    throws java.io.IOException
Fill the buffer, return true if eof has been reached.


readUnsignedShort

private final int readUnsignedShort()
                             throws java.io.IOException