Class SMTPTransport.ChunkedOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
    Enclosing class:
    SMTPTransport

    private class SMTPTransport.ChunkedOutputStream
    extends java.io.OutputStream
    An OutputStream that buffers data in chunks and uses the RFC 3030 BDAT SMTP command to send each chunk.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private byte[] buf  
      private int count  
      private java.io.OutputStream out  
    • Constructor Summary

      Constructors 
      Constructor Description
      ChunkedOutputStream​(java.io.OutputStream out, int size)
      Create a ChunkedOutputStream built on top of the specified underlying output stream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void bdat​(byte[] b, int off, int len, boolean last)
      Send the specified bytes using the BDAT command.
      void close()
      Close this output stream.
      void flush()
      Flush this output stream.
      void write​(byte[] b, int off, int len)
      Writes len bytes to this output stream starting at off.
      void write​(int b)
      Writes the specified byte to this output stream.
      • Methods inherited from class java.io.OutputStream

        nullOutputStream, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • out

        private final java.io.OutputStream out
      • buf

        private final byte[] buf
      • count

        private int count
    • Constructor Detail

      • ChunkedOutputStream

        public ChunkedOutputStream​(java.io.OutputStream out,
                                   int size)
        Create a ChunkedOutputStream built on top of the specified underlying output stream.
        Parameters:
        out - the underlying output stream
        size - the chunk size
    • Method Detail

      • write

        public void write​(int b)
                   throws java.io.IOException
        Writes the specified byte to this output stream.
        Specified by:
        write in class java.io.OutputStream
        Parameters:
        b - the byte to write
        Throws:
        java.io.IOException - for I/O errors
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException
        Writes len bytes to this output stream starting at off.
        Overrides:
        write in class java.io.OutputStream
        Parameters:
        b - bytes to write
        off - offset in array
        len - number of bytes to write
        Throws:
        java.io.IOException - for I/O errors
      • flush

        public void flush()
                   throws java.io.IOException
        Flush this output stream.
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.OutputStream
        Throws:
        java.io.IOException - for I/O errors
      • close

        public void close()
                   throws java.io.IOException
        Close this output stream.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
        Throws:
        java.io.IOException - for I/O errors
      • bdat

        private void bdat​(byte[] b,
                          int off,
                          int len,
                          boolean last)
                   throws java.io.IOException
        Send the specified bytes using the BDAT command.
        Throws:
        java.io.IOException