com.hs.mail.io
Class CharTerminatedInputStream
java.lang.Object
java.io.InputStream
com.hs.mail.io.CharTerminatedInputStream
- All Implemented Interfaces:
- Closeable
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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 wrappedterminator
- the array of characters that will terminate the stream.
- Throws:
IllegalArgumentException
- if the terminator array is null or empty
read
public int read()
throws IOException
- Read a byte off this stream.
- Specified by:
read
in class InputStream
- 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 © 2011. All Rights Reserved.