Example #1
0
  @Test
  public void packLongCompat() throws IOException {
    DataOutputByteArray b = new DataOutputByteArray();
    b.packLong(2111L);
    b.packLong(100);
    b.packLong(1111L);

    DataInputByteArray b2 = new DataInputByteArray(b.buf);
    assertEquals(2111L, b2.unpackLong());
    assertEquals(100L, b2.unpackLong());
    assertEquals(1111L, b2.unpackLong());

    DataInputByteBuffer b3 = new DataInputByteBuffer(ByteBuffer.wrap(b.buf), 0);
    assertEquals(2111L, b3.unpackLong());
    assertEquals(100L, b3.unpackLong());
    assertEquals(1111L, b3.unpackLong());
  }