Class BZip2OutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable, BZip2Constants

    public class BZip2OutputStream
    extends java.io.OutputStream
    implements BZip2Constants
    An output stream that compresses into the BZip2 format (without the file header chars) into another stream. TODO: Update to BZip2 1.0.1
    Author:
    Keiron Liddle
    • Field Detail

      • m_crc

        private CRC m_crc
      • m_inUse

        private boolean[] m_inUse
      • m_seqToUnseq

        private char[] m_seqToUnseq
      • m_unseqToSeq

        private char[] m_unseqToSeq
      • m_selector

        private char[] m_selector
      • m_selectorMtf

        private char[] m_selectorMtf
      • m_mtfFreq

        private int[] m_mtfFreq
      • m_currentChar

        private int m_currentChar
      • m_runLength

        private int m_runLength
      • m_closed

        private boolean m_closed
      • m_incs

        private int[] m_incs
      • m_blockRandomised

        private boolean m_blockRandomised
      • m_blockSize100k

        private int m_blockSize100k
      • m_bsBuff

        private int m_bsBuff
      • m_bsLive

        private int m_bsLive
      • m_last

        private int m_last
      • m_origPtr

        private int m_origPtr
      • m_allowableBlockSize

        private int m_allowableBlockSize
      • m_block

        private char[] m_block
      • m_blockCRC

        private int m_blockCRC
      • m_combinedCRC

        private int m_combinedCRC
      • m_bsStream

        private java.io.OutputStream m_bsStream
      • m_firstAttempt

        private boolean m_firstAttempt
      • m_ftab

        private int[] m_ftab
      • m_nInUse

        private int m_nInUse
      • m_nMTF

        private int m_nMTF
      • m_quadrant

        private int[] m_quadrant
      • m_szptr

        private short[] m_szptr
      • m_workDone

        private int m_workDone
      • m_workFactor

        private int m_workFactor
      • m_workLimit

        private int m_workLimit
      • m_zptr

        private int[] m_zptr
    • Constructor Detail

      • BZip2OutputStream

        public BZip2OutputStream​(java.io.OutputStream output)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • BZip2OutputStream

        public BZip2OutputStream​(java.io.OutputStream output,
                                 int blockSize)
                          throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • hbMakeCodeLengths

        private static void hbMakeCodeLengths​(char[] len,
                                              int[] freq,
                                              int alphaSize,
                                              int maxLen)
      • calculateWeight

        private static int calculateWeight​(int v1,
                                           int v2)
      • panic

        private static void panic()
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
        Throws:
        java.io.IOException
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • flush

        public void flush()
                   throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(int bv)
                   throws java.io.IOException
        modified by Oliver Merkel, 010128
        Specified by:
        write in class java.io.OutputStream
        Parameters:
        bv - Description of Parameter
        Throws:
        java.io.IOException - Description of Exception
      • allocateCompressStructures

        private void allocateCompressStructures()
      • bsFinishedWithStream

        private void bsFinishedWithStream()
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • bsPutIntVS

        private void bsPutIntVS​(int numBits,
                                int c)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • bsPutUChar

        private void bsPutUChar​(int c)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • bsPutint

        private void bsPutint​(int u)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • bsSetStream

        private void bsSetStream​(java.io.OutputStream f)
      • bsW

        private void bsW​(int n,
                         int v)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • doReversibleTransformation

        private void doReversibleTransformation()
      • endBlock

        private void endBlock()
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • endCompression

        private void endCompression()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • fullGtU

        private boolean fullGtU​(int i1,
                                int i2)
      • generateMTFValues

        private void generateMTFValues()
      • hbAssignCodes

        private void hbAssignCodes​(int[] code,
                                   char[] length,
                                   int minLen,
                                   int maxLen,
                                   int alphaSize)
      • initBlock

        private void initBlock()
      • initialize

        private void initialize()
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • mainSort

        private void mainSort()
      • makeMaps

        private void makeMaps()
      • med3

        private char med3​(char a,
                          char b,
                          char c)
      • moveToFrontCodeAndSend

        private void moveToFrontCodeAndSend()
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • qSort3

        private void qSort3​(int loSt,
                            int hiSt,
                            int dSt)
      • randomiseBlock

        private void randomiseBlock()
      • sendMTFValues

        private void sendMTFValues()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • simpleSort

        private void simpleSort​(int lo,
                                int hi,
                                int d)
      • vswap

        private void vswap​(int p1,
                           int p2,
                           int n)
      • writeRun

        private void writeRun()
                       throws java.io.IOException
        Throws:
        java.io.IOException