Class BitPacking.BitPackingWriter

  • Enclosing class:
    BitPacking

    public abstract static class BitPacking.BitPackingWriter
    extends Object
    to writes ints to a stream packed to only the needed bits. there is no guarantee of corecteness if ints larger than the max size are written
    • Constructor Detail

      • BitPackingWriter

        public BitPackingWriter()
    • Method Detail

      • write

        public abstract void write​(int val)
                            throws IOException
        will write the bits to the underlying stream aligned on the buffer size
        Parameters:
        val - the value to encode
        Throws:
        IOException - if there is an exception while writing
      • finish

        public abstract void finish()
                             throws IOException
        will flush the buffer to the underlying stream (and pad with 0s)
        Throws:
        IOException - if there is an exception while finishing