Class Base64.OutputStream

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Enclosing class:
Base64

public static class Base64.OutputStream extends FilterOutputStream
A Base64.OutputStream will write data to another OutputStream, given in the constructor, and encode/decode to/from Base64 notation on the fly.
Since:
1.3
See Also:
  • Constructor Details

  • Method Details

    • write

      public void write(int theByte) throws IOException
      Writes the byte to the output stream after converting to/from Base64 notation. When encoding, bytes are buffered three at a time before the output stream actually gets a write() call. When decoding, bytes are buffered four at a time.
      Overrides:
      write in class FilterOutputStream
      Parameters:
      theByte - the byte to write
      Throws:
      IOException
      Since:
      1.3
    • write

      public void write(byte[] theBytes, int off, int len) throws IOException
      Calls write(int) repeatedly until len bytes are written.
      Overrides:
      write in class FilterOutputStream
      Parameters:
      theBytes - array from which to read bytes
      off - offset for array
      len - max number of bytes to read into array
      Throws:
      IOException
      Since:
      1.3
    • flush

      public void flush() throws IOException
      Appropriately pads Base64 notation when encoding or throws an exception if Base64 input is not properly padded when decoding.
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class FilterOutputStream
      Throws:
      IOException
      Since:
      1.3
    • close

      public void close() throws IOException
      Flushes and closes stream.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class FilterOutputStream
      Throws:
      IOException
      Since:
      1.3