|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--de.rw7.token.FastInput
No concurrency for this and is;
| Inner Class Summary | |
class |
FastInput.EndException This exception is thrown by any method accessing the input stream, when the end of stream is reached. |
| Field Summary | |
private int |
blocksread Number of bytes read without the currently loaded buffer. |
private byte[] |
buf |
private byte[] |
buf_bak |
private java.io.InputStream |
is The input stream. |
private int |
len Valid bytes in buffer. |
private static int |
minimumBytesToRead The number bytes at least to be read on every readBuffer call. |
private int |
nbuf |
private int |
now The current byte in buffer, next to be read. |
| Constructor Summary | |
FastInput() Constructs a FastInput instance with default buffer size of 4kB. |
|
FastInput(java.io.InputStream is) Constructs a FastInput instance with default buffer size of 4kB and opens it with the given InputStream. |
|
FastInput(int nbuf) Constructs a FastInput instance with custom buffer size. |
|
| Method Summary | |
void |
close() Closes the input stream. |
int |
getBytesRead() |
void |
open(java.io.InputStream is) Opens the FastInput object. |
char |
peek() Reads a single character from the stream without moving the file pointer. |
void |
pushBack() Moves the file pointer back by one character. pushBack() is available only for one character. |
char |
read() Reads a single character from the stream. |
private void |
readBuffer() Reads a new buffer. |
void |
skipUntil(byte c) Skips input until the first occurence of the given character. |
char |
skipUntil(byte c1, byte c2) Skips input until the first occurence of one of the two given characters. |
char |
skipUntil(byte c1, byte c2, byte c3) Skips input until the first occurence of one of the three given characters. |
char |
skipUntil(byte c1, byte c2, byte c3, byte c4) Skips input until the first occurence of one of the four given characters. |
void |
skipWhile(byte c) Skips input for all subsequent occurences of the given character. |
java.lang.String |
toString() Return a string showing the file pointer as a pipeline character in the context of the characters in the stream. |
CharNode |
traverse(CharNode n) The file pointer stops before the first character which not in the tree. |
| Methods inherited from class java.lang.Object |
<clinit>, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
| Field Detail |
private java.io.InputStream is
close()private int nbuf
private byte[] buf
private byte[] buf_bak
private int blocksread
private int len
private int now
pushBack()private static final int minimumBytesToRead
readBuffer()| Constructor Detail |
public FastInput(java.io.InputStream is)
open(java.io.InputStream)public FastInput()
open(java.io.InputStream)public FastInput(int nbuf)
open(java.io.InputStream)| Method Detail |
public final void open(java.io.InputStream is)
java.lang.IllegalArgumentException - if the FastInput object is already open.close()
public final void close()
throws java.io.IOException
open(java.io.InputStream)
private final void readBuffer()
throws java.io.IOException,
FastInput.EndException
pushBack()public final int getBytesRead()
public final void pushBack()
There is no explicit pushback buffer. The buffer pointer (now) simply gets decreased by one. The class ensures, that the buffer pointer is not zero outside of public methods, whenever pushBack() is available.
skipWhile(byte)
public final char read()
throws java.io.IOException,
FastInput.EndException
pushBack()
public final char peek()
throws java.io.IOException,
FastInput.EndException
pushBack()
public final void skipUntil(byte c)
throws java.io.IOException,
FastInput.EndException
pushBack()
public final char skipUntil(byte c1,
byte c2)
throws java.io.IOException,
FastInput.EndException
pushBack()
public final char skipUntil(byte c1,
byte c2,
byte c3)
throws java.io.IOException,
FastInput.EndException
pushBack()
public final char skipUntil(byte c1,
byte c2,
byte c3,
byte c4)
throws java.io.IOException,
FastInput.EndException
pushBack()
public final void skipWhile(byte c)
throws java.io.IOException,
FastInput.EndException
pushBack()
public final CharNode traverse(CharNode n)
throws java.io.IOException,
FastInput.EndException
pushBack()public final java.lang.String toString()
toString in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||