Class DotUnstuffingInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.subethamail.smtp.io.DotUnstuffingInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class DotUnstuffingInputStream extends FilterInputStream
Removes the dot-stuffing happening during the NNTP and SMTP message transfer
  • Field Details

    • 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 Details

    • DotUnstuffingInputStream

      public DotUnstuffingInputStream(InputStream in)
  • Method Details

    • read

      public int read() throws IOException
      Read through the stream, checking for '\r\n.'
      Overrides:
      read in class FilterInputStream
      Returns:
      the byte read from the stream
      Throws:
      IOException
    • read

      public int read(byte[] b, int off, int len) throws IOException
      Read through the stream, checking for '\r\n.'
      Overrides:
      read in class 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:
      IOException
    • getBaseStream

      public InputStream getBaseStream()
      Provide access to the base input stream.