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

Class prominence.io.ASCIIInputStream

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

public class ASCIIInputStream
extends FilterInputStream
A FilterInputStream that provides methods to read ASCII-format data from an InputStream.

Variable Index

 o pushback
The most-recently unread byte.

Constructor Index

 o ASCIIInputStream(InputStream)
Creates a new ASCIIInputStream.

Method Index

 o read()
Reads a byte from the attached stream.
 o read(byte[], int, int)
Reads a subarray of bytes from the attached stream.
 o readInt()
Reads an ASCII-format int from the attached stream; skips any preceeding whitespace and reads digits up to the first non-digit.
 o readWord()
Reads an ASCII-format word from the attached stream; skips any preceeding whitespace and reads the next consecutive sequence of non-whitespace characters.
 o unread(int)
Unreads a single byte of data.
 o ws()
Skips any immediate whitespace in the attached stream.

Variables

 o pushback
  protected int pushback
The most-recently unread byte.

Constructors

 o ASCIIInputStream
  public ASCIIInputStream(InputStream in)
Creates a new ASCIIInputStream.
Parameters:
in - The InputStream from which to read data

Methods

 o read
  public int read() throws IOException
Reads a byte from the attached stream. Supports unreading facility.
Returns:
The byte read, or -1 at EOF
Overrides:
read in class FilterInputStream
 o read
  public int read(byte b[],
                  int o,
                  int l) throws IOException
Reads a subarray of bytes from the attached stream. Supports unreading facility.
Parameters:
b - An array of bytes
o - The start index at which to read
l - The number of bytes to read
Returns:
The number of bytes read
Overrides:
read in class FilterInputStream
 o unread
  protected void unread(int x)
Unreads a single byte of data.
Parameters:
x - The byte to unread; can be EOF
 o ws
  public void ws() throws IOException
Skips any immediate whitespace in the attached stream.
 o readInt
  public int readInt() throws IOException
Reads an ASCII-format int from the attached stream; skips any preceeding whitespace and reads digits up to the first non-digit.

Valid integers: 123, -123

Returns:
The integer value
Throws: IOException
Occurs if a read fails, the EOF is reached before any digits are read, or a non-digit character occurs before any digit.
 o readWord
  public String readWord() throws IOException
Reads an ASCII-format word from the attached stream; skips any preceeding whitespace and reads the next consecutive sequence of non-whitespace characters.
Returns:
The word just read
Throws: IOException
Occurs if a read fails or if the EOF is reached before any non-whitespace characters are read.

All Packages  Class Hierarchy  This Package  Previous  Next  Index