Class AbstractBase64EncodingOutputStream

    • Constructor Detail

      • AbstractBase64EncodingOutputStream

        public AbstractBase64EncodingOutputStream​(boolean ignoreFlush)
        Constructor.
        Parameters:
        ignoreFlush - Specifies if calls to flush() should be ignored. Setting this to true is particular useful in conjunction with DataHandler.writeTo(OutputStream): that method may call flush() after writing the data, but the call to DataHandler.writeTo(OutputStream) must be followed by a call to close() or complete() which would then output a single chunk with a few bytes. In some cases this may be inconvenient.
    • Method Detail

      • complete

        public final void complete()
                            throws IOException
        Write out any pending data, including padding if necessary.
        Throws:
        IOException - if an I/O error occurs
      • doWrite

        protected abstract void doWrite​(byte[] b)
                                 throws IOException
        Write base64 encoded data. If necessary, the implementation should accumulate the data in a buffer before writing it to the underlying stream.
        Parameters:
        b - a byte array of length 4
        Throws:
        IOException - if an I/O error occurs
      • flushBuffer

        protected abstract void flushBuffer()
                                     throws IOException
        Write any pending data to the underlying stream, if applicable. Note that implementations should not flush the underlying stream.
        Throws:
        IOException - if an I/O error occurs
      • doFlush

        protected abstract void doFlush()
                                 throws IOException
        Flush the underlying stream, if applicable.
        Throws:
        IOException - if an I/O error occurs
      • doClose

        protected abstract void doClose()
                                 throws IOException
        Close the underlying stream, if applicable.
        Throws:
        IOException - if an I/O error occurs