The Encog Project

org.encog.bot.html
Class PeekableInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.encog.bot.html.PeekableInputStream
All Implemented Interfaces:
java.io.Closeable

public class PeekableInputStream
extends java.io.InputStream

PeekableInputStream: This is a special input stream that allows the program to peek one or more characters ahead in the file.


Field Summary
static int INITIAL_DEPTH
          The depth to peek.
 
Constructor Summary
PeekableInputStream(java.io.InputStream is)
          The constructor accepts an InputStream to setup the object.
 
Method Summary
 int peek()
          Peek at the next character from the stream.
 int peek(int depth)
          Peek at a specified depth.
 int read()
          Read a single byte from the stream.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_DEPTH

public static final int INITIAL_DEPTH
The depth to peek.

See Also:
Constant Field Values
Constructor Detail

PeekableInputStream

public PeekableInputStream(java.io.InputStream is)
The constructor accepts an InputStream to setup the object.

Parameters:
is - The InputStream to parse.
Method Detail

peek

public int peek()
         throws java.io.IOException
Peek at the next character from the stream.

Returns:
The next character.
Throws:
java.io.IOException - If an I/O exception occurs.

peek

public int peek(int depth)
         throws java.io.IOException
Peek at a specified depth.

Parameters:
depth - The depth to check.
Returns:
The character peeked at.
Throws:
java.io.IOException - If an I/O exception occurs.

read

public int read()
         throws java.io.IOException
Read a single byte from the stream. @throws IOException If an I/O exception occurs. @return The character that was read from the stream.

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

The Encog Project