Class java.io.InputStreamBuffer
All Packages    This Package    Previous    Next

Class java.io.InputStreamBuffer

java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.InputStreamBuffer

public class InputStreamBuffer
extends InputStream
This class implements a buffer that can be used as an InputStream.
Version:
1.11, 31 Jan 1995
Author:
Arthur van Hoff

buf
The buffer.
count
The number of characters to use in the buffer.
pos
The position in the buffer.

InputStreamBuffer(byte[])
Creates an InputStreamBuffer, given an array of bytes.
InputStreamBuffer(byte[], int)
Creates an InputStreamBuffer, given an array of bytes.

available()
Returns the number of available bytes in the buffer.
read()
Reads a byte.
read(byte[], int, int)
Reads into an array of bytes.
reset()
Resets the buffer to the beginning.
skip(int)
Skips bytes of input.

buf
  protected byte buf[]
The buffer.
pos
  protected int pos
The position in the buffer.
count
  protected int count
The number of characters to use in the buffer.

InputStreamBuffer
  public InputStreamBuffer(byte buf[])
Creates an InputStreamBuffer, given an array of bytes.
Parameters:
buf - the input buffer (not copied)

InputStreamBuffer

  public InputStreamBuffer(byte buf[],
                           int length)
Creates an InputStreamBuffer, given an array of bytes.
Parameters:
buf - the input buffer (not copied)
length - the number of bytes in the buffer

read
  public synchronized int read()
Reads a byte.
Returns:
the byte read, or -1 if the end of the stream is reached.
Overrides:
read in class InputStream

read

  public synchronized int read(byte b[],
                               int off,
                               int len)
Reads into an array of bytes. For efficiency, this method should be overridden in a subclass (the default implementation reads 1 byte at a time).
Parameters:
b - the buffer into which the data is read
off - the start offset of the data
len - the maximum number of bytes read
Returns:
the actual number of bytes read; -1 is returned when the end of the stream is reached.
Overrides:
read in class InputStream

skip

  public synchronized int skip(int n)
Skips bytes of input.
Parameters:
n - bytes to be skipped
Returns:
actual number of bytes skipped
Overrides:
skip in class InputStream

available

  public synchronized int available()
Returns the number of available bytes in the buffer.
Returns:
the number of available bytes
Overrides:
available in class InputStream

reset

  public synchronized void reset()
Resets the buffer to the beginning.
Overrides:
reset in class InputStream


All Packages    This Package    Previous    Next