Examples of PositionedByteRange


Examples of org.apache.hadoop.hbase.util.PositionedByteRange

  public void testReadWrite() {
    for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
      RawString type =
          Order.ASCENDING == ord ? RawString.ASCENDING : RawString.DESCENDING;
      for (String val : VALUES) {
        PositionedByteRange buff = new SimplePositionedMutableByteRange(Bytes.toBytes(val).length);
        assertEquals(buff.getLength(), type.encode(buff, val));
        byte[] expected = Bytes.toBytes(val);
        ord.apply(expected);
        assertArrayEquals(expected, buff.getBytes());
        buff.setPosition(0);
        assertEquals(val, type.decode(buff));
        buff.setPosition(0);
        assertEquals(buff.getLength(), type.skip(buff));
        assertEquals(buff.getLength(), buff.getPosition());
      }
    }
  }
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.