/** * Reads a zero-compressed encoded long from input buffer and returns it. * @param buffer Binary array * @param offset Offset into array at which vint begins. * @throws java.io.IOException e * @return deserialized long from buffer. * @deprecated Use {@link #readAsVLong(byte[],int)} instead. */ @Deprecated public static long readVLong(final byte [] buffer, final int offset) throws IOException { return readAsVLong(buffer, offset); }
public void testReadAsVLong() throws Exception { long [] longs = {-1l, 123l, Long.MIN_VALUE, Long.MAX_VALUE}; for (int i = 0; i < longs.length; i++) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream output = new DataOutputStream(baos); WritableUtils.writeVLong(output, longs[i]); byte[] long_bytes_no_offset = baos.toByteArray(); assertEquals(longs[i], Bytes.readAsVLong(long_bytes_no_offset, 0)); byte[] long_bytes_with_offset = bytesWithOffset(long_bytes_no_offset); assertEquals(longs[i], Bytes.readAsVLong(long_bytes_with_offset, 1)); } }
/** * Reads a zero-compressed encoded long from input buffer and returns it. * @param buffer Binary array * @param offset Offset into array at which vint begins. * @throws java.io.IOException e * @return deserialized long from buffer. * @deprecated Use {@link #readAsVLong(byte[],int)} instead. */ @Deprecated public static long readVLong(final byte [] buffer, final int offset) throws IOException { return readAsVLong(buffer, offset); }
/** * Reads a zero-compressed encoded long from input buffer and returns it. * @param buffer Binary array * @param offset Offset into array at which vint begins. * @throws java.io.IOException e * @return deserialized long from buffer. * @deprecated Use {@link #readAsVLong(byte[],int)} instead. */ @Deprecated public static long readVLong(final byte [] buffer, final int offset) throws IOException { return readAsVLong(buffer, offset); }
/** * Reads a zero-compressed encoded long from input buffer and returns it. * @param buffer Binary array * @param offset Offset into array at which vint begins. * @throws java.io.IOException e * @return deserialized long from buffer. * @deprecated Use {@link #readAsVLong(byte[],int)} instead. */ @Deprecated public static long readVLong(final byte [] buffer, final int offset) throws IOException { return readAsVLong(buffer, offset); }
public void testReadAsVLong() throws Exception { long [] longs = {-1l, 123l, Long.MIN_VALUE, Long.MAX_VALUE}; for (int i = 0; i < longs.length; i++) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream output = new DataOutputStream(baos); WritableUtils.writeVLong(output, longs[i]); byte[] long_bytes_no_offset = baos.toByteArray(); assertEquals(longs[i], Bytes.readAsVLong(long_bytes_no_offset, 0)); byte[] long_bytes_with_offset = bytesWithOffset(long_bytes_no_offset); assertEquals(longs[i], Bytes.readAsVLong(long_bytes_with_offset, 1)); } }
public void testReadAsVLong() throws Exception { long [] longs = {-1l, 123l, Long.MIN_VALUE, Long.MAX_VALUE}; for (int i = 0; i < longs.length; i++) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream output = new DataOutputStream(baos); WritableUtils.writeVLong(output, longs[i]); byte[] long_bytes_no_offset = baos.toByteArray(); assertEquals(longs[i], Bytes.readAsVLong(long_bytes_no_offset, 0)); byte[] long_bytes_with_offset = bytesWithOffset(long_bytes_no_offset); assertEquals(longs[i], Bytes.readAsVLong(long_bytes_with_offset, 1)); } }
memstoreTS = Bytes.readAsVLong(blockBuffer.array(), blockBuffer.arrayOffset() + blockBuffer.position()); memstoreTSLen = WritableUtils.getVIntSize(memstoreTS);
int memstoreTSOffset = blockBuffer.arrayOffset() + blockBuffer.position() + KEY_VALUE_LEN_SIZE + klen + vlen; memstoreTS = Bytes.readAsVLong(blockBuffer.array(), memstoreTSOffset); memstoreTSLen = WritableUtils.getVIntSize(memstoreTS); } else {