borland Packages  Class Hierarchy  jb.io Package 

FastBufferedInputStream class

java.lang.Object
   +----java.io.InputStream
           +----java.io.FilterInputStream
                   +----com.borland.jb.io.FastBufferedInputStream

About the FastBufferedInputStream class

Variables  Constructors  Properties  Methods  

An unsynchronized buffered input stream that reads in characters from a stream without causing a read every time. The data is read into a buffer, then subsequent reads result in fast buffer access. This class is patterned after java.io.BufferedInputStream. The primary difference is that all access is unsynchronized (not thread-safe), for faster response.


FastBufferedInputStream variables

Variables implemented in java.io.FilterInputStream

FastBufferedInputStream constructors

FastBufferedInputStream properties

*Read-only properties **Write-only properties

Properties implemented in java.lang.Object

FastBufferedInputStream methods

Methods implemented in this class

Methods implemented in java.io.FilterInputStream

Methods implemented in java.lang.Object


FastBufferedInputStream constructors

FastBufferedInputStream(java.io.InputStream)

  public FastBufferedInputStream(InputStream in)
Creates a new buffered stream with a default buffer size of 2048 characters.

Parameters:

in
The input stream.

FastBufferedInputStream(java.io.InputStream, int)

  public FastBufferedInputStream(InputStream in, int size)
Creates a new buffered stream with the specified buffer size.

Parameters:

in
The in stream.
size
The buffer size.

FastBufferedInputStream methods

available()

  public int available()
Returns the number of bytes that can be read without blocking. This total is the number of bytes in the buffer and the number of bytes available from the input stream.

Overrides: java.io.FilterInputStream.available()

fill()

  protected void fill()
Reads as much as will fit into buffers.

mark(int)

  public void mark(int readlimit)
Marks the current position in the input stream. A subsequent call to the reset() method will reposition the stream at the last marked position so that subsequent reads will re-read the same bytes. The stream promises to allow readlimit bytes to be read before the mark position gets invalidated.

Parameters:

readlimit
The maximum limit of bytes allowed to be read before the mark position becomes invalid.

Overrides: java.io.FilterInputStream.mark(int)

markSupported()

  public boolean markSupported()
Returns a boolean indicating if this stream type supports mark/reset.

Overrides: java.io.FilterInputStream.markSupported()

read()

  public int read()
Reads a byte of data. This method will block if no input is available.

This method returns the byte read, or -1 if the end of the stream is reached. If an I/O error occurrs, read() throws an IOException.

Overrides: java.io.FilterInputStream.read()

read(byte[], int, int)

  public int read(byte[] copyBuffer, int off, int len)
Reads into an array of bytes. Blocks until some input is available.

This method returns the actual number of bytes read, or -1 when the end of the stream is reached. If an I/O error occurrs, this method throws an IOException.

Parameters:

copyBuffer
The buffer into which the data is read.
len
The maximum number of bytes read.

Overrides: java.io.FilterInputStream.read(byte[], int, int)

reset()

  public synchronized void reset()
Repositions the stream to the last marked position. If the stream has not been marked, or if the mark has been invalidated, an IOException is thrown.

Stream marks are intended to be used in situations where you need to read ahead a little to see what's in the stream. Often this is most easily done by invoking a general parser.

Overrides: java.io.FilterInputStream.reset()

skip(long)

  public long skip(long n)
Skips the specified number of bytes of input.

This method returns the actual number of bytes skipped. If an I/O error occurrs, it throws an IOException.

Parameters:

n
The number of bytes to be skipped.

Overrides: java.io.FilterInputStream.skip(long)

unread()

  public void unread()
"Pushes" the given character back into the input buffer so the next read() will return it.