Class AbstractCompressor<H>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static int[] POWER  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean checkIntOnByteArray​(java.io.InputStream stream, int i)  
      protected boolean checkShortOnByteArray​(java.io.InputStream stream, short i)  
      protected void deflate​(short[] object, java.io.OutputStream stream, int length)  
      protected void deflate​(ShortShortMultiset object, java.io.OutputStream stream, int length)  
      protected boolean deflateWithCheck​(ShortShortMultiset object, int length, java.io.InputStream input)  
      protected boolean equalsDeflating​(H head, CompressedStore<?> store, long l)  
      static int getBitsPerVar​(byte[] vars)  
      static int getBitsPerVar​(short[] vars)  
      protected ShortShortMultiset inflateContent​(java.io.InputStream stream, int[] ids, short length)  
      protected short[] inflateContentToArray​(java.io.InputStream stream, int[] ids, short length)  
      protected static BitMask makeBitMask​(int size, short[] values)  
      protected static BitMask makeBitMask​(int size, ShortShortMultiset indices)  
      protected static BitMask makeShortListBitMask​(int size, short[] marking)  
      protected boolean readBooleanFromStream​(java.io.InputStream stream)  
      protected double readDoubleFromStream​(java.io.InputStream stream)
      Return the first eight bytes as an long
      protected int readIntFromStream​(java.io.InputStream stream)
      Return the first four bytes as an integer
      static void readInto​(byte[] toRead, byte[] vars, int bitsPerVar)
      reads a byte[] of vars from a byte[] toRead, where each element of vars is encoded using precisely bitsPerVar bits.
      static void readInto​(byte[] toRead, short[] vars, int bitsPerVar)
      reads a byte[] of vars from a byte[] toRead, where each element of vars is encoded using precisely bitsPerVar bits.
      protected long readLongFromStream​(java.io.InputStream stream)
      Return the first eight bytes as an long
      protected BitMask readMask​(java.io.InputStream stream, int length, int numBytes)  
      protected short readShortFromStream​(java.io.InputStream stream)  
      protected void writeBooleanToByteArray​(java.io.OutputStream stream, boolean b)  
      protected void writeDoubleToByteArray​(java.io.OutputStream stream, double v)
      Write 4 bytes of an integer
      protected void writeIntToByteArray​(java.io.OutputStream out, int v)
      Write 4 bytes of an integer
      protected void writeLongToByteArray​(java.io.OutputStream stream, long v)  
      protected void writeShortToByteArray​(java.io.OutputStream stream, short i)  
      static void writeTo​(byte[] toWrite, byte[] vars, int bitsPerVar)
      writes a byte[] of vars into a byte[] toWrite, where each element of vars is encoded using precisely bitsPerVar bits.
      static void writeTo​(byte[] toWrite, short[] vars, int bitsPerVar)
      writes a byte[] of vars into a byte[] toWrite, where each element of vars is encoded using precisely bitsPerVar bits.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • POWER

        protected static final int[] POWER
    • Constructor Detail

      • AbstractCompressor

        public AbstractCompressor()
    • Method Detail

      • readMask

        protected BitMask readMask​(java.io.InputStream stream,
                                   int length,
                                   int numBytes)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • inflateContent

        protected ShortShortMultiset inflateContent​(java.io.InputStream stream,
                                                    int[] ids,
                                                    short length)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • inflateContentToArray

        protected short[] inflateContentToArray​(java.io.InputStream stream,
                                                int[] ids,
                                                short length)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writeShortToByteArray

        protected void writeShortToByteArray​(java.io.OutputStream stream,
                                             short i)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • writeBooleanToByteArray

        protected void writeBooleanToByteArray​(java.io.OutputStream stream,
                                               boolean b)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • checkShortOnByteArray

        protected boolean checkShortOnByteArray​(java.io.InputStream stream,
                                                short i)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • readShortFromStream

        protected short readShortFromStream​(java.io.InputStream stream)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • writeIntToByteArray

        protected void writeIntToByteArray​(java.io.OutputStream out,
                                           int v)
                                    throws java.io.IOException
        Write 4 bytes of an integer
        Parameters:
        stream -
        next -
        Throws:
        java.io.IOException
      • writeLongToByteArray

        protected void writeLongToByteArray​(java.io.OutputStream stream,
                                            long v)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • writeDoubleToByteArray

        protected void writeDoubleToByteArray​(java.io.OutputStream stream,
                                              double v)
                                       throws java.io.IOException
        Write 4 bytes of an integer
        Parameters:
        stream -
        next -
        Throws:
        java.io.IOException
      • checkIntOnByteArray

        protected boolean checkIntOnByteArray​(java.io.InputStream stream,
                                              int i)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • readDoubleFromStream

        protected double readDoubleFromStream​(java.io.InputStream stream)
                                       throws java.io.IOException
        Return the first eight bytes as an long
        Parameters:
        stream -
        Returns:
        Throws:
        java.io.IOException
      • readLongFromStream

        protected long readLongFromStream​(java.io.InputStream stream)
                                   throws java.io.IOException
        Return the first eight bytes as an long
        Parameters:
        stream -
        Returns:
        Throws:
        java.io.IOException
      • readIntFromStream

        protected int readIntFromStream​(java.io.InputStream stream)
                                 throws java.io.IOException
        Return the first four bytes as an integer
        Parameters:
        stream -
        Returns:
        Throws:
        java.io.IOException
      • readBooleanFromStream

        protected boolean readBooleanFromStream​(java.io.InputStream stream)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • deflate

        protected void deflate​(ShortShortMultiset object,
                               java.io.OutputStream stream,
                               int length)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • deflate

        protected void deflate​(short[] object,
                               java.io.OutputStream stream,
                               int length)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • deflateWithCheck

        protected boolean deflateWithCheck​(ShortShortMultiset object,
                                           int length,
                                           java.io.InputStream input)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • makeBitMask

        protected static BitMask makeBitMask​(int size,
                                             short[] values)
      • makeShortListBitMask

        protected static BitMask makeShortListBitMask​(int size,
                                                      short[] marking)
      • equalsDeflating

        protected boolean equalsDeflating​(H head,
                                          CompressedStore<?> store,
                                          long l)
      • writeTo

        public static void writeTo​(byte[] toWrite,
                                   byte[] vars,
                                   int bitsPerVar)
        writes a byte[] of vars into a byte[] toWrite, where each element of vars is encoded using precisely bitsPerVar bits. If bitsPerVar == 8, the result is identical to the input
        Parameters:
        toWrite - the byte[] to write to. The size should be at least Math.ceil(vars.length/8*bitsPerVar)
        vars - the byte[] to encode.
        bitsPerVar - the number of bits per element of var. For all i: vars[i] < (1 << bitsPerVar)
      • readInto

        public static void readInto​(byte[] toRead,
                                    byte[] vars,
                                    int bitsPerVar)
        reads a byte[] of vars from a byte[] toRead, where each element of vars is encoded using precisely bitsPerVar bits.
        Parameters:
        toRead - the byte[] to read from. The size should be at least Math.ceil(vars.length/8*bitsPerVar)
        vars - the byte[] to fill.
        bitsPerVar - the number of bits per element of var. For all i: vars[i] < (1 << bitsPerVar)
      • getBitsPerVar

        public static int getBitsPerVar​(byte[] vars)
      • getBitsPerVar

        public static int getBitsPerVar​(short[] vars)
      • writeTo

        public static void writeTo​(byte[] toWrite,
                                   short[] vars,
                                   int bitsPerVar)
        writes a byte[] of vars into a byte[] toWrite, where each element of vars is encoded using precisely bitsPerVar bits. If bitsPerVar == 8, the result is identical to the input
        Parameters:
        toWrite - the byte[] to write to. The size should be at least Math.ceil(vars.length/8*bitsPerVar)
        vars - the byte[] to encode.
        bitsPerVar - the number of bits per element of var. For all i: vars[i] < (1 << bitsPerVar)
      • readInto

        public static void readInto​(byte[] toRead,
                                    short[] vars,
                                    int bitsPerVar)
        reads a byte[] of vars from a byte[] toRead, where each element of vars is encoded using precisely bitsPerVar bits.
        Parameters:
        toRead - the byte[] to read from. The size should be at least Math.ceil(vars.length/8*bitsPerVar)
        vars - the byte[] to fill.
        bitsPerVar - the number of bits per element of var. For all i: vars[i] < (1 << bitsPerVar)