org.apache.james.util
Class CharTerminatedInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byorg.apache.james.util.CharTerminatedInputStream

public class CharTerminatedInputStream
extends InputStream

An InputStream class that terminates the stream when it encounters a particular byte sequence.

Version:
1.0.0, 24/04/1999

Constructor Summary
CharTerminatedInputStream(InputStream in, char[] terminator)
          A constructor for this object that takes a stream to be wrapped and a terminating character sequence.
 
Method Summary
 int read()
          Read a byte off this stream.
 
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
 

Constructor Detail

CharTerminatedInputStream

public CharTerminatedInputStream(InputStream in,
                                 char[] terminator)
A constructor for this object that takes a stream to be wrapped and a terminating character sequence.

Parameters:
in - the InputStream to be wrapped
terminator - the array of characters that will terminate the stream.
Throws:
IllegalArgumentException - if the terminator array is null or empty
Method Detail

read

public int read()
         throws IOException
Read a byte off this stream.

Returns:
the byte read off the stream
Throws:
IOException - if an IOException is encountered while reading off the stream
ProtocolException - if the underlying stream returns -1 before the terminator is seen.


"Copyright © 1999-2006 Apache Jakarta Project. All Rights Reserved."