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

Field Summary
protected  boolean includeTerminator
           
protected  java.io.InputStream inputStream
           
protected  int match
           
protected  int matchLength
           
protected  byte[] terminator
           
 
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
 

Field Detail

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
Constructor Detail

ByteTerminatedInputStream

public ByteTerminatedInputStream(java.io.InputStream inputStream,
                                 byte[] terminator,
                                 boolean includeTerminator)
Creates a new input stream
Parameters:
inputStream - The source input stream
terminator - The possible terminators
includeTerminator - Return the terminator also as element of the stream or not
Method Detail

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

©   O R C A   S y s t e m s