org.jwarp.util.io
Class ByteTerminatedInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--org.jwarp.util.io.ByteTerminatedInputStream
- public class ByteTerminatedInputStream
- extends java.io.InputStream
This an input stream which termination property can be set depending on a special
terminating character.
- Author:
- Anatole Tresch
|
Constructor Summary |
ByteTerminatedInputStream(java.io.InputStream inputStream,
byte[] terminator,
boolean includeTerminator)
Creates a new input stream |
|
Method Summary |
protected int |
getNext()
Read the next value. |
int |
read()
Read the next value. |
| 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 |
includeTerminator
protected final boolean includeTerminator
inputStream
protected final java.io.InputStream inputStream
terminator
protected final byte[] terminator
matchLength
protected final int matchLength
match
protected int match
ByteTerminatedInputStream
public ByteTerminatedInputStream(java.io.InputStream inputStream,
byte[] terminator,
boolean includeTerminator)
- Creates a new input stream
- Parameters:
inputStream - The source input streamterminator - The possible terminatorsincludeTerminator - Return the terminator also as element of the stream or not
read
public int read()
throws java.io.IOException
- Read the next value.
- Overrides:
read in class java.io.InputStream
- Returns:
- The bytes read.
getNext
protected final int getNext()
throws java.io.IOException
- Read the next value. Check for terminaters.
- Returns:
- The next value