Class ASCII85OutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.xmlgraphics.util.io.ASCII85OutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, ASCII85Constants, Finalizable

public class ASCII85OutputStream extends FilterOutputStream implements ASCII85Constants, Finalizable
This class applies a ASCII85 encoding to the stream.
Version:
$Id$
  • Field Details

    • DEBUG

      private static final boolean DEBUG
      See Also:
    • pos

      private int pos
    • buffer

      private long buffer
    • posinline

      private int posinline
    • bw

      private int bw
  • Constructor Details

  • Method Details

    • write

      public void write(int b) throws IOException
      Overrides:
      write in class FilterOutputStream
      Throws:
      IOException
      See Also:
    • checkedWrite

      private void checkedWrite(byte[] buf) throws IOException
      Throws:
      IOException
    • checkedWrite

      private void checkedWrite(byte[] buf, boolean nosplit) throws IOException
      Throws:
      IOException
    • checkedWrite

      private void checkedWrite(byte[] buf, int len) throws IOException
      Throws:
      IOException
    • checkedWrite

      private void checkedWrite(byte[] buf, int len, boolean nosplit) throws IOException
      Throws:
      IOException
    • convertWord

      private byte[] convertWord(long word)
      This converts a 32 bit value (4 bytes) into 5 bytes using base 85. each byte in the result starts with zero at the '!' character so the resulting base85 number fits into printable ascii chars
      Parameters:
      word - the 32 bit unsigned (hence the long datatype) word
      Returns:
      5 bytes (or a single byte of the 'z' character for word values of 0)
    • finalizeStream

      public void finalizeStream() throws IOException
      Description copied from interface: Finalizable
      This method can be called instead of close() on a subclass of FilteredOutputStream when a final marker has to be written to the target stream, but close() cannot be called.
      Specified by:
      finalizeStream in interface Finalizable
      Throws:
      IOException - In case of an IO problem
      See Also:
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class FilterOutputStream
      Throws:
      IOException
      See Also: