Esempio n. 1
0
  /*
   * Unsigned Medium Int tests
   */
  @Test
  public void testGetAndSetMediumInt() throws Exception {
    DynamicByteBuffer buf = new DynamicByteBuffer();
    buf.putUnsigned(0x12);
    buf.putUnsigned(0x34);
    buf.putUnsigned(0x56);

    buf.flip();

    assertEquals(0x123456, buf.getUnsignedMediumInt());
  }
Esempio n. 2
0
  @SuppressWarnings("deprecation")
  @Test
  public void testGetAndSetMediumInt2() throws Exception {
    DynamicByteBuffer buf = new DynamicByteBuffer();
    buf.order(java.nio.ByteOrder.LITTLE_ENDIAN);

    buf.putUnsigned(0x12);
    buf.putUnsigned(0x34);
    buf.putUnsigned(0x56);

    buf.flip();

    assertEquals(0x563412, buf.getUnsignedMediumInt());
  }
Esempio n. 3
0
 @Test(expected = BufferUnderflowException.class)
 public void testGetAndSetGetMediumIntException3() {
   DynamicByteBuffer buf = DynamicByteBuffer.allocate(0);
   buf.getUnsignedMediumInt();
 }