org.apache.myfaces.trinidad.util

## Class Base64OutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.apache.myfaces.trinidad.util.Base64OutputStream

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

      public class Base64OutputStream
      extends OutputStream

  An OutputStream that encodes data in a base64 representation. It takes a Writer as its single argument to its constructor and all bytes written to the stream are correspondingly converted into Base64 and written out to the provided writer.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Base64OutputStream(Writer out)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Call this method to indicate end of data stream and to append any padding characters if necessary.
    `void` | `finish()` Deprecated. use the close() method instead.
    `void` | `flush()`
    `void` | `write(byte[] b, int off, int len)` Writes len bytes from the specified byte array starting at offset off to this output stream.
    `void` | `write(int b)` Takes a byte writes it out to the writer

    - ### Methods inherited from class java.io.OutputStream

      `write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Base64OutputStream

          public Base64OutputStream(Writer out)

  - ### Method Detail

    - #### write

          public void write(int b)
                     throws IOException

      Takes a byte writes it out to the writer
      Specified by:
        `write` in class `OutputStream`
      Parameters:
        `b` - a byte
      Throws:
        `IOException`

    - #### write

          public void write(byte[] b,
                   int off,
                   int len)
                     throws IOException,
                            NullPointerException

      Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation. The write method of OutputStream calls the write method of one argument on each of the bytes to be written out. Subclasses are encouraged to override this method and provide a more efficient implementation. If b is null, a NullPointerException is thrown. If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.
      Overrides:
        `write` in class `OutputStream`
      Parameters:
        `b` - the data
        `off` - the start offset in the data
        `len` - the number of bytes to read
      Throws:
        `IOException`
        `NullPointerException`

    - #### flush

          public void flush()
                     throws IOException

      Specified by:
        `flush` in interface `Flushable`
      Overrides:
        `flush` in class `OutputStream`
      Throws:
        `IOException`

    - #### finish

          @Deprecated
          public void finish()
                      throws IOException

      Deprecated. use the close() method instead.
      Call this method to indicate end of data stream and to append any padding characters if necessary. This method should be called only if there will be no subsequent calls to a write method. Subsequent calls to the write method will result in incorrect encoding.
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Call this method to indicate end of data stream and to append any padding characters if necessary. This method should be called only if there will be no subsequent calls to a write method. Subsequent calls to the write method will result in incorrect encoding.
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `OutputStream`
      Throws:
        `IOException`

Copyright © 2001-2016 The Apache Software Foundation. All Rights Reserved.