public static float readFloat(byte[] bytes, int offset) { return Float.intBitsToFloat(readInt(bytes, offset)); }
public static int readIntFromStream(InputStream inputStream) throws IOException { byte[] arr = new byte[4]; readFully(arr, inputStream); return readInt(arr, 0); }
public int readInt() { require(4); return Bytes.readInt(buffer, getAndIncrementPosition(4)); }
private void loadNextMiniBlock() { currentIndex = 0; int bitWidth = Bytes.readInt(buffer, getAndIncrementPosition(4)); int minDelta = Bytes.readInt(buffer, getAndIncrementPosition(4)); int numValuesToRead = Bytes.readInt(buffer, getAndIncrementPosition(4)); totalValueCount -= numValuesToRead; int strideSize = Bytes.sizeInBytes(8, bitWidth); Int32BytePacker packer = Packers.LITTLE_ENDIAN.packer32(bitWidth); for (int i = 0; i < numValuesToRead; i += 8) { packer.unpack8Values(buffer, getAndIncrementPosition(strideSize), intBuffer, i); } for (int i = 0; i < numValuesToRead; i++) { intBuffer[i] += ((i == 0) ? firstValue : intBuffer[i - 1]) + minDelta; } }
private void loadNextMiniBlock() { currentIndex = 0; int bitWidth = Bytes.readInt(buffer, getAndIncrementPosition(4)); int minDelta = Bytes.readInt(buffer, getAndIncrementPosition(4)); int numValuesToRead = Bytes.readInt(buffer, getAndIncrementPosition(4)); totalValueCount -= numValuesToRead; int strideSize = Bytes.sizeInBytes(8, bitWidth); Int32BytePacker packer = Packers.LITTLE_ENDIAN.packer32(bitWidth); for (int i = 0; i < numValuesToRead; i += 8) { packer.unpack8Values(buffer, getAndIncrementPosition(strideSize), intBuffer, i); } for (int i = 0; i < numValuesToRead; i++) { intBuffer[i] += ((i == 0) ? firstValue : intBuffer[i - 1]) + minDelta; } }
private void loadNextMiniBlock() { currentIndex = 0; int bitWidth = Bytes.readInt(buffer, getAndIncrementPosition(4)); int minDelta = Bytes.readInt(buffer, getAndIncrementPosition(4)); int numValuesToRead = Bytes.readInt(buffer, getAndIncrementPosition(4)); totalValueCount -= numValuesToRead; int strideSize = Bytes.sizeInBytes(8, bitWidth); Int32BytePacker packer = Packers.LITTLE_ENDIAN.packer32(bitWidth); for (int i = 0; i < numValuesToRead; i += 8) { packer.unpack8Values(buffer, getAndIncrementPosition(strideSize), intBuffer, i); } for (int i = 0; i < numValuesToRead; i++) { intBuffer[i] += ((i == 0) ? firstValue : intBuffer[i - 1]) + minDelta; } }
private void loadNextMiniBlock() { currentIndex = 0; require(8); int numValuesToRead = Bytes.readInt(buffer, getAndIncrementPosition(4)); int bitWidth = Bytes.readInt(buffer, getAndIncrementPosition(4)); if (numValuesToRead > 0) { int strideSize = Bytes.sizeInBytes(8, bitWidth); Int32BytePacker packer = Packers.LITTLE_ENDIAN.packer32(bitWidth); for (int i = 0; i < numValuesToRead; i += 8) { packer.unpack8Values(buffer, getAndIncrementPosition(strideSize), currentMiniBlock, i); } } }
private void loadNextMiniBlock() { currentIndex = 0; require(8); int numValuesToRead = Bytes.readInt(buffer, getAndIncrementPosition(4)); int bitWidth = Bytes.readInt(buffer, getAndIncrementPosition(4)); if (numValuesToRead > 0) { int strideSize = Bytes.sizeInBytes(8, bitWidth); Int32BytePacker packer = Packers.LITTLE_ENDIAN.packer32(bitWidth); for (int i = 0; i < numValuesToRead; i += 8) { packer.unpack8Values(buffer, getAndIncrementPosition(strideSize), currentMiniBlock, i); } } }
private void loadNextMiniBlock() { currentIndex = 0; require(8); int numValuesToRead = Bytes.readInt(buffer, getAndIncrementPosition(4)); int bitWidth = Bytes.readInt(buffer, getAndIncrementPosition(4)); if (numValuesToRead > 0) { int strideSize = Bytes.sizeInBytes(8, bitWidth); Int32BytePacker packer = Packers.LITTLE_ENDIAN.packer32(bitWidth); for (int i = 0; i < numValuesToRead; i += 8) { packer.unpack8Values(buffer, getAndIncrementPosition(strideSize), currentMiniBlock, i); } } }