Class AbstractBitCodec<T>

    • Constructor Detail

      • AbstractBitCodec

        public AbstractBitCodec()
    • Method Detail

      • read

        public abstract T read​(BitInputStream bitInputStream)
                        throws IOException
        Description copied from interface: BitCodec
        Read a single object from the bit stream.
        Specified by:
        read in interface BitCodec<T>
        Parameters:
        bitInputStream - the bit input stream to rad from
        Returns:
        an object from the stream
        Throws:
        IOException - as per java IO contract
      • read

        public abstract T read​(BitInputStream bitInputStream,
                               int valueLen)
                        throws IOException
        Description copied from interface: BitCodec
        Read a array of specified length from the bit stream.
        Specified by:
        read in interface BitCodec<T>
        Parameters:
        bitInputStream - the bit input stream to rad from param valueLen the number of elements to read
        Returns:
        an object from the stream
        Throws:
        IOException - as per java IO contract
      • readInto

        public void readInto​(BitInputStream bitInputStream,
                             byte[] array,
                             int offset,
                             int valueLen)
                      throws IOException
        Description copied from interface: BitCodec
        Read a array of specified length from the bit stream into a given byte array. This method is a way to optimize byte array IO operations by bypassing abstraction. Leaky, I know.
        Specified by:
        readInto in interface BitCodec<T>
        Parameters:
        bitInputStream - the bit input stream to rad from
        array - the array to read into
        offset - offset in the array
        valueLen - number of elements to read
        Throws:
        IOException - as per java IO contract
      • skip

        public void skip​(BitInputStream bitInputStream)
                  throws IOException
        Description copied from interface: BitCodec
        Skip the next object in the bit stream.
        Specified by:
        skip in interface BitCodec<T>
        Parameters:
        bitInputStream - the bit stream to operate on
        Throws:
        IOException - as per java IO contract
      • skip

        public void skip​(BitInputStream bitInputStream,
                         int length)
                  throws IOException
        Description copied from interface: BitCodec
        Skip the next length objects in the bit stream.
        Specified by:
        skip in interface BitCodec<T>
        Parameters:
        bitInputStream - the bit stream to operate on
        length - the number of objects to skip
        Throws:
        IOException - as per java IO contract
      • write

        public abstract long write​(BitOutputStream bitOutputStream,
                                   T object)
                            throws IOException
        Description copied from interface: BitCodec
        Write an object into the bit stream
        Specified by:
        write in interface BitCodec<T>
        Parameters:
        bitOutputStream - the output bit stream to write to
        object - the object to write
        Returns:
        the number of bits written out
        Throws:
        IOException - as per java IO contract
      • numberOfBits

        public abstract long numberOfBits​(T object)
        Description copied from interface: BitCodec
        Calculate the number of bits that the object would take in bit serialized form.
        Specified by:
        numberOfBits in interface BitCodec<T>
        Parameters:
        object - an object
        Returns:
        the number of bits