org.subethamail.smtp.server.io
Class DotUnstuffingInputStream

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

public class DotUnstuffingInputStream
extends java.io.FilterInputStream

Removes the dot-stuffing happening during the NNTP and SMTP message transfer


Field Summary
protected  int[] last
          An array to hold the last two bytes read off the stream.
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
DotUnstuffingInputStream(java.io.InputStream in)
           
 
Method Summary
 void close()
           
 int read()
          Read through the stream, checking for '\r\n.'
 int read(byte[] b, int off, int len)
          Read through the stream, checking for '\r\n.'
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

last

protected int[] last
An array to hold the last two bytes read off the stream. This allows the stream to detect '\r\n' sequences even when they occur across read boundaries.

Constructor Detail

DotUnstuffingInputStream

public DotUnstuffingInputStream(java.io.InputStream in)
Method Detail

read

public int read()
         throws java.io.IOException
Read through the stream, checking for '\r\n.'

Overrides:
read in class java.io.FilterInputStream
Returns:
the byte read from the stream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Read through the stream, checking for '\r\n.'

Overrides:
read in class java.io.FilterInputStream
Parameters:
b - the byte array into which the bytes will be read
off - the offset into the byte array where the bytes will be inserted
len - the maximum number of bytes to be read off the stream
Returns:
the number of bytes read
Throws:
java.io.IOException

close

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


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