alice.util
Class StringInputStream

java.lang.Object
java.io.InputStream
alice.util.StringInputStream
- All Implemented Interfaces:
- java.io.Closeable
- public class StringInputStream
- extends java.io.InputStream
managing a String or other InputStream as
a character source
Field Summary |
private int |
line
current line on stream |
private int |
pos
current char pos on stream |
private java.lang.String |
source
alternative input source |
Method Summary |
int |
getCurrentLine()
|
int |
getCurrentPos()
|
int |
read()
read a char |
void |
reset()
This method resets a stream to the point where the
mark() method was called. |
void |
seek(int n)
go to n-th char |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
source
private java.lang.String source
- alternative input source
pos
private int pos
- current char pos on stream
line
private int line
- current line on stream
StringInputStream
public StringInputStream(java.lang.String s)
read
public int read()
throws java.io.IOException
- read a char
reset
public void reset()
throws java.io.IOException
- Description copied from class:
java.io.InputStream
- This method resets a stream to the point where the
mark()
method was called. Any bytes that were read
after the mark point was set will be re-read during subsequent
reads.
This method always throws an IOException in this class, but subclasses
can override this method if they provide mark/reset functionality.
seek
public void seek(int n)
- go to n-th char
getCurrentPos
public int getCurrentPos()
getCurrentLine
public int getCurrentLine()