Class BufferedBase64OutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
uk.ac.starlink.util.BufferedBase64OutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class BufferedBase64OutputStream extends FilterOutputStream
OutputStream that encodes to Base64 with buffering. Considerably faster than unbuffered implementations.

Note that the endBase64() method should be called once at the end of writing to flush the input and ensure that the output is ended correctly. Closing the stream will call this if it has not been called already.

Since:
31 Mar 2022
Author:
Mark Taylor
  • Constructor Details

    • BufferedBase64OutputStream

      public BufferedBase64OutputStream(OutputStream out)
      Constructor with default characteristics.
      Parameters:
      out - underlying output stream, doesn't need to be buffered
    • BufferedBase64OutputStream

      public BufferedBase64OutputStream(OutputStream out, int quadsPerLine, byte[] lineEnd, int linesPerBuf)
      Custom constructor.
      Parameters:
      out - underlying output stream, doesn't need to be buffered
      quadsPerLine - number of 4-byte groups per output line
      lineEnd - sequence of bytes to be written after each output line
      linesPerBuf - number of lines buffered before an actual write to the underlying stream is performed
  • Method Details