Examples of alignRead()


Examples of com.peterhi.runtime.BitStream.alignRead()

 
  @Test
  public void testAlignRead() throws Exception {
    BitStream bs = new BitStream(new byte[] { 1, 1 }, 0, Byte.SIZE * 2);
    assertEquals(1, bs.readBit());
    bs.alignRead();
    assertEquals(1, bs.readBit());
    assertEquals(7, bs.available());
    assertEquals(2, bs.bytes());
  }
 
View Full Code Here

Examples of com.peterhi.runtime.BitStream.alignRead()

 
  @Test
  public void testClear() throws Exception {
    BitStream bs = new BitStream(2);
    bs.writeBit(1);
    bs.alignRead();
    bs.writeBit(0);
    bs.writeBit(1);
    assertEquals(1, bs.readBit());
    bs.clear();
    assertEquals(-1, bs.readBit());
View Full Code Here

Examples of com.peterhi.runtime.Buffer.alignRead()

   
    // 0000000[1 000000]01
    assertEquals(0, testBuffer.read());
   
    // 0000000[1 ]00000001
    assertEquals(6, testBuffer.alignRead());
   
    // 0000000[1 ]00000001
    assertEquals(0, testBuffer.alignRead());
   
    // 0000000[]1 00000001
View Full Code Here

Examples of com.peterhi.runtime.Buffer.alignRead()

   
    // 0000000[1 ]00000001
    assertEquals(6, testBuffer.alignRead());
   
    // 0000000[1 ]00000001
    assertEquals(0, testBuffer.alignRead());
   
    // 0000000[]1 00000001
    assertEquals(1, testBuffer.read());

    // 0000000[]1 00000001 ==> EOF
View Full Code Here

Examples of com.peterhi.runtime.Buffer.alignRead()

    // 0000000[]1 00000001 ==> EOF
    assertEquals(-1, testBuffer.read());
   
    // 0000000[]1 00000001 ==> ERR: ']' cannot go beyond '['
    assertEquals(-1, testBuffer.alignRead());
  }
 
  @Test
  public void testToByteArray() throws Exception {
    {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.