Class ReadStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.FilterInputStream
              |
              +--ReadStream

public class ReadStream
extends java.io.FilterInputStream

A stream for reading basic types from input.


Field Summary
protected  boolean absorbNL
           
protected  boolean atEOF
           
protected  char[] buffer
           
protected  int buffersize
           
protected  int buffertop
           
protected  java.io.DataInputStream strm
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
ReadStream()
          post: constructs a pascal-like stream based on System.in
ReadStream(java.io.InputStream strm)
          pre: strm is a valid input stream.
 
Method Summary
 boolean eof()
          test if the end-of-file is reached
 boolean eoln()
          returns true if next stream char is a eoln char
 char peek()
          returns next character in stream, without consuming it
 void pushbackChar(char c)
          pushes back character, possibly clearing EOF; if c == 0, does nothing
 boolean readBoolean()
          returns next boolean value read from input
 char readChar()
          returns next character, or 0 for eof
 double readDouble()
          post: reads in double value
 float readFloat()
          reads floating point value and returns value
 void readFully(byte[] b)
          reads an array of bytes from stream
 void readFully(byte[] b, int off, int len)
          reads a portion of an array of bytes from stream
 int readInt()
          reads an integer from stream
 java.lang.String readLine()
          reads remainder of line, returns as string
 void readln()
          reads input stream until end-of-line (\r or \n or \n\r)
 long readLong()
          reads a long integer from stream
 short readShort()
          reads a short integer from stream
 java.lang.String readString()
          reads next word as string
 java.lang.String readUTF()
           
 void skipWhite()
          post: input pointer is at EOF, or non-whitespace char
 
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

strm

protected java.io.DataInputStream strm

atEOF

protected boolean atEOF

buffer

protected char[] buffer

buffersize

protected int buffersize

buffertop

protected int buffertop

absorbNL

protected boolean absorbNL
Constructor Detail

ReadStream

public ReadStream()
post: constructs a pascal-like stream based on System.in


ReadStream

public ReadStream(java.io.InputStream strm)
pre: strm is a valid input stream. post: constructs a pascal-like stream based on strm This stream filters input from a data input stream which filters input from strm.

Method Detail

eof

public boolean eof()
test if the end-of-file is reached


peek

public char peek()
returns next character in stream, without consuming it


eoln

public boolean eoln()
returns true if next stream char is a eoln char


readln

public void readln()
reads input stream until end-of-line (\r or \n or \n\r)


skipWhite

public void skipWhite()
post: input pointer is at EOF, or non-whitespace char


readString

public java.lang.String readString()
reads next word as string


readBoolean

public boolean readBoolean()
returns next boolean value read from input


readChar

public char readChar()
returns next character, or 0 for eof


pushbackChar

public void pushbackChar(char c)
pushes back character, possibly clearing EOF; if c == 0, does nothing


readDouble

public double readDouble()
post: reads in double value


readFloat

public float readFloat()
reads floating point value and returns value


readFully

public void readFully(byte[] b)
               throws java.io.IOException
reads an array of bytes from stream

java.io.IOException

readFully

public void readFully(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException
reads a portion of an array of bytes from stream

java.io.IOException

readShort

public short readShort()
reads a short integer from stream


readInt

public int readInt()
reads an integer from stream


readLong

public long readLong()
reads a long integer from stream


readLine

public java.lang.String readLine()
reads remainder of line, returns as string


readUTF

public java.lang.String readUTF()
                         throws java.io.IOException
java.io.IOException