org.subethamail.smtp.server.io
Class CharTerminatedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.subethamail.smtp.server.io.CharTerminatedInputStream
All Implemented Interfaces:
java.io.Closeable

public class CharTerminatedInputStream
extends java.io.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(java.io.InputStream in, char[] terminator)
          A constructor for this object that takes a stream to be wrapped and a terminating character sequence.
 
Method Summary
 void close()
           
 int read()
          Read a byte off this stream.
 
Methods inherited from class java.io.InputStream
available, 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(java.io.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:
java.lang.IllegalArgumentException - if the terminator array is null or empty
Method Detail

read

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

Specified by:
read in class java.io.InputStream
Returns:
the byte read off the stream
Throws:
java.io.IOException - if an IOException is encountered while reading off the stream
java.net.ProtocolException - if the underlying stream returns -1 before the terminator is seen.

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException


Copyright © 2011 SubEthaSMTP. All Rights Reserved. Build version: UNVERSIONED