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
-
buffer
- The buffer array.
-
buffIndex
- The current read index in the buffer.
-
buffSize
- The amount of data in the buffer.
-
MyBufferedInputStream(InputStream)
- Creates a new MyBufferedInputStream with the default
buffer size (512 bytes).
-
MyBufferedInputStream(InputStream, int)
- Creates a new MyBufferedInputStream with a specified
buffer size.
-
available()
- Returns the number of bytes available to read without
blocking.
-
fillBuffer()
- Fills the internal buffer from the attached stream.
-
read()
- Reads a single byte from the attached stream, using buffering
to make I/O more efficient.
-
read(byte[], int, int)
- Reads a subarray of bytes from the attached stream, using
buffering to make I/O more efficient.
buffer
protected byte buffer[]
- The buffer array.
buffSize
protected int buffSize
- The amount of data in the buffer.
buffIndex
protected int buffIndex
- The current read index in the buffer.
MyBufferedInputStream
public MyBufferedInputStream(InputStream i)
- Creates a new MyBufferedInputStream with the default
buffer size (512 bytes).
- Parameters:
- i - The InputStream to read from
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
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
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
fillBuffer
protected void fillBuffer() throws IOException
- Fills the internal buffer from the attached stream.
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