@Override public void finish() throws IOException { while (count != 0) { // downside: this aligns on whatever the buffer size is. write(0); } // check this does not impede perf out = null; }
/** * @param bitLength the width in bits of the integers to write * @param out the stream to write the bytes to * @return the correct implementation for the width */ public static BitPackingWriter getBitPackingWriter(int bitLength, OutputStream out) { switch (bitLength) { case 0: return new ZeroBitPackingWriter(); case 1: return new OneBitPackingWriter(out); case 2: return new TwoBitPackingWriter(out); case 3: return new ThreeBitPackingWriter(out); case 4: return new FourBitPackingWriter(out); case 5: return new FiveBitPackingWriter(out); case 6: return new SixBitPackingWriter(out); case 7: return new SevenBitPackingWriter(out); case 8: return new EightBitPackingWriter(out); default: throw new UnsupportedOperationException("only support up to 8 for now"); } }
/** * @param bitLength the width in bits of the integers to write * @param out the stream to write the bytes to * @return the correct implementation for the width */ public static BitPackingWriter getBitPackingWriter(int bitLength, OutputStream out) { switch (bitLength) { case 0: return new ZeroBitPackingWriter(); case 1: return new OneBitPackingWriter(out); case 2: return new TwoBitPackingWriter(out); case 3: return new ThreeBitPackingWriter(out); case 4: return new FourBitPackingWriter(out); case 5: return new FiveBitPackingWriter(out); case 6: return new SixBitPackingWriter(out); case 7: return new SevenBitPackingWriter(out); case 8: return new EightBitPackingWriter(out); default: throw new UnsupportedOperationException("only support up to 8 for now"); } }
@Override public void finish() throws IOException { while (count != 0) { // downside: this aligns on whatever the buffer size is. write(0); } // check this does not impede perf out = null; }