org.encog.parse
Class PeekableInputStream

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

public class PeekableInputStream
extends InputStream

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(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.
 boolean peek(String str)
          Peek ahead and see if the specified string is present.
 int read()
          Read a single byte from the stream.
 long skip(long count)
          Skip the specified number of bytes.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, reset
 
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(InputStream is)
The constructor accepts an InputStream to setup the object.

Parameters:
is - The InputStream to parse.
Method Detail

peek

public int peek()
Peek at the next character from the stream.

Returns:
The next character.

peek

public int peek(int depth)
Peek at a specified depth.

Parameters:
depth - The depth to check.
Returns:
The character peeked at.

peek

public boolean peek(String str)
Peek ahead and see if the specified string is present.

Parameters:
str - The string we are looking for.
Returns:
True if the string was found.

read

public int read()
Read a single byte from the stream.

Specified by:
read in class InputStream
Returns:
The character that was read from the stream.

skip

public long skip(long count)
Skip the specified number of bytes.

Overrides:
skip in class InputStream
Parameters:
count - The number of bytes to skip.
Returns:
The actual number of bytes skipped.


Copyright © 2014. All Rights Reserved.