예제 #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());
  }
예제 #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());
  }
예제 #3
0
 @Test(expected = BufferUnderflowException.class)
 public void testGetAndSetGetMediumIntException3() {
   DynamicByteBuffer buf = DynamicByteBuffer.allocate(0);
   buf.getUnsignedMediumInt();
 }