@Override public int read() throws IOException { if (count == 0) { if (valueCount - totalRead < 8) { buffer = 0; int bitsToRead = 5 * (int)(valueCount - totalRead); int bytesToRead = alignToBytes(bitsToRead); for (int i = 5 - 1; i >= 5 - bytesToRead ; i--) { buffer |= (((long)in.read()) & 255) << (i * 8); } count = 8; totalRead = valueCount; } else { buffer = ((((long)in.read()) & 255) << 32) + ((((long)in.read()) & 255) << 24) + (in.read() << 16) + (in.read() << 8) + in.read(); count = 8; totalRead += 8; } } int result = (((int)(buffer >> ((count - 1) * 5))) & 31); -- count; return result; }
return new FourBitPackingReader(in); case 5: return new FiveBitPackingReader(in, valueCount); case 6: return new SixBitPackingReader(in, valueCount);
return new FourBitPackingReader(in); case 5: return new FiveBitPackingReader(in, valueCount); case 6: return new SixBitPackingReader(in, valueCount);
@Override public int read() throws IOException { if (count == 0) { if (valueCount - totalRead < 8) { buffer = 0; int bitsToRead = 5 * (int)(valueCount - totalRead); int bytesToRead = alignToBytes(bitsToRead); for (int i = 5 - 1; i >= 5 - bytesToRead ; i--) { buffer |= (((long)in.read()) & 255) << (i * 8); } count = 8; totalRead = valueCount; } else { buffer = ((((long)in.read()) & 255) << 32) + ((((long)in.read()) & 255) << 24) + (in.read() << 16) + (in.read() << 8) + in.read(); count = 8; totalRead += 8; } } int result = (((int)(buffer >> ((count - 1) * 5))) & 31); -- count; return result; }