Class prominence.io.MyBufferedInputStream
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class prominence.io.MyBufferedInputStream

java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----prominence.io.MyBufferedInputStream

public class MyBufferedInputStream
extends FilterInputStream
A FilterInputStream that provides input buffering.
See Also:
BufferedInputStream

Variable Index

 o buffer
The buffer array.
 o buffIndex
The current read index in the buffer.
 o buffSize
The amount of data in the buffer.

Constructor Index

 o MyBufferedInputStream(InputStream)
Creates a new MyBufferedInputStream with the default buffer size (512 bytes).
 o MyBufferedInputStream(InputStream, int)
Creates a new MyBufferedInputStream with a specified buffer size.

Method Index

 o available()
Returns the number of bytes available to read without blocking.
 o fillBuffer()
Fills the internal buffer from the attached stream.
 o read()
Reads a single byte from the attached stream, using buffering to make I/O more efficient.
 o read(byte[], int, int)
Reads a subarray of bytes from the attached stream, using buffering to make I/O more efficient.

Variables

 o buffer
  protected byte buffer[]
The buffer array.
 o buffSize
  protected int buffSize
The amount of data in the buffer.
 o buffIndex
  protected int buffIndex
The current read index in the buffer.

Constructors

 o MyBufferedInputStream
  public MyBufferedInputStream(InputStream i)
Creates a new MyBufferedInputStream with the default buffer size (512 bytes).
Parameters:
i - The InputStream to read from
 o MyBufferedInputStream
  public MyBufferedInputStream(InputStream i,
                               int size)
Creates a new MyBufferedInputStream with a specified buffer size.
Parameters:
i - The InputStream to read from
size - The buffer size

Methods

 o available
  public int available() throws IOException
Returns the number of bytes available to read without blocking.
Returns:
The number of available bytes
Overrides:
available in class FilterInputStream
 o read
  public int read() throws IOException
Reads a single byte from the attached stream, using buffering to make I/O more efficient.
Returns:
The byte read, or -1 at EOF
Overrides:
read in class FilterInputStream
 o fillBuffer
  protected void fillBuffer() throws IOException
Fills the internal buffer from the attached stream.
 o read
  public int read(byte buf[],
                  int off,
                  int num) throws IOException
Reads a subarray of bytes from the attached stream, using buffering to make I/O more efficient.
Parameters:
buf - The array into which to read
off - The offset at which to read
num - The number of bytes to read
Returns:
The number of bytes successfully read, or -1 at EOF
Overrides:
read in class FilterInputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index