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.
-
pushback
- The most-recently unread byte.
-
ASCIIInputStream(InputStream)
- Creates a new ASCIIInputStream.
-
read()
- Reads a byte from the attached stream.
-
read(byte[], int, int)
- Reads a subarray of bytes from the attached stream.
-
readInt()
- Reads an ASCII-format int from the attached stream;
skips any preceeding whitespace and reads digits up to the first
non-digit.
-
readWord()
- Reads an ASCII-format word from the attached stream;
skips any preceeding whitespace and reads the next consecutive
sequence of non-whitespace characters.
-
unread(int)
- Unreads a single byte of data.
-
ws()
- Skips any immediate whitespace in the attached stream.
pushback
protected int pushback
- The most-recently unread byte.
ASCIIInputStream
public ASCIIInputStream(InputStream in)
- Creates a new ASCIIInputStream.
- Parameters:
- in - The InputStream from which to read data
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
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
unread
protected void unread(int x)
- Unreads a single byte of data.
- Parameters:
- x - The byte to unread; can be EOF
ws
public void ws() throws IOException
- Skips any immediate whitespace in the attached stream.
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.
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