|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
structure.ReadStream
public class ReadStream
A ReadStream provides reasonable access to the typewritten data on an input stream. Usually, a ReadStream is constructed with no parameters, causing the ReadStream to open access to System.in. The access methods allow one to read from the stream, much as is done with Pascal.
| Field Summary | |
|---|---|
protected boolean |
absorbNL
Whether or not accept the CR as part of previous newline. |
protected boolean |
atEOF
True iff we've seen the end-of-file |
protected char[] |
buffer
The buffer to hold pushback characters |
protected int |
buffersize
The number of characters to be stored in buffer. |
protected int |
buffertop
|
protected java.io.DataInputStream |
strm
The underlying data stream. |
| Fields inherited from class java.io.FilterInputStream |
|---|
in |
| Constructor Summary | |
|---|---|
ReadStream()
Construct an empty ReadStream, obtaining info from System.in. |
|
ReadStream(java.io.InputStream strm)
Construct a ReadStream based on pre-existing input stream. |
|
| Method Summary | |
|---|---|
boolean |
eof()
Determine if we've seen end-of-file. |
boolean |
eoln()
Return true if the next character to be read is an end-of-line mark. |
char |
getFirst()
Read (but don't consume) next char in stream. |
void |
pushbackChar(char c)
Return character to input stream for reading at later time. |
boolean |
readBoolean()
Read the next word "true" or "false" as a boolean. |
char |
readChar()
Read next character, whitespace or not. |
double |
readDouble()
Reads the next double value from input stream. |
float |
readFloat()
Read floating point value from input (Currently not working). |
void |
readFully(byte[] b)
Read an array of bytes from input. |
void |
readFully(byte[] b,
int off,
int len)
Read input into byte array. |
int |
readInt()
Reads an integer from input stream. |
java.lang.String |
readLine()
Read the remainder of line, including end-of-line mark. |
void |
readln()
Read characters up to and including the end-of-line mark. |
long |
readLong()
Read a (potentially long) input. |
short |
readShort()
Reads an integer from input stream. |
java.lang.String |
readString()
Skip white space and read in the next non-whitespace word as a string. |
java.lang.String |
readUTF()
Read unicode from input. |
void |
skipWhite()
Consume all the white-space characters until EOF or other data. |
| Methods inherited from class java.io.FilterInputStream |
|---|
available, close, mark, markSupported, read, read, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.io.DataInputStream strm
protected boolean atEOF
protected char[] buffer
protected int buffersize
protected int buffertop
protected boolean absorbNL
| Constructor Detail |
|---|
public ReadStream()
public ReadStream(java.io.InputStream strm)
strm - The pre-existing input stream.| Method Detail |
|---|
public boolean eof()
public char getFirst()
public boolean eoln()
public void readln()
public void skipWhite()
public java.lang.String readString()
public boolean readBoolean()
public char readChar()
public void pushbackChar(char c)
c - The character to push back onto input stream.public double readDouble()
public float readFloat()
public void readFully(byte[] b)
throws java.io.IOException
b - The array of bytes; holds result.
java.io.IOException
public void readFully(byte[] b,
int off,
int len)
throws java.io.IOException
b - Target array of bytes.off - Offset into byte array to start reading.len - Number of bytes to be read.
java.io.IOExceptionpublic short readShort()
public int readInt()
public long readLong()
public java.lang.String readLine()
public java.lang.String readUTF()
throws java.io.IOException
java.io.IOException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||