本文整理汇总了Java中org.apache.hadoop.hbase.util.Order.ASCENDING属性的典型用法代码示例。如果您正苦于以下问题:Java Order.ASCENDING属性的具体用法?Java Order.ASCENDING怎么用?Java Order.ASCENDING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.hbase.util.Order
的用法示例。
在下文中一共展示了Order.ASCENDING属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReadWriteNonSkippable
@Test
public void testReadWriteNonSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(12);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] term : TERMINATORS) {
for (byte[] val : VALUES_BYTES) {
buff.setPosition(0);
DataType<byte[]> type = new TerminatedWrapper<byte[]>(new RawBytes(ord), term);
assertEquals(val.length + term.length, type.encode(buff, val));
buff.setPosition(0);
assertArrayEquals(val, type.decode(buff));
assertEquals(val.length + term.length, buff.getPosition());
}
}
}
}
示例2: testSkipNonSkippable
@Test
public void testSkipNonSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(12);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] term : TERMINATORS) {
for (byte[] val : VALUES_BYTES) {
buff.setPosition(0);
DataType<byte[]> type = new TerminatedWrapper<byte[]>(new RawBytes(ord), term);
int expected = type.encode(buff, val);
buff.setPosition(0);
assertEquals(expected, type.skip(buff));
assertEquals(expected, buff.getPosition());
}
}
}
}
示例3: testReadWrite
@Test
public void testReadWrite() {
for (int limit : limits) {
PositionedByteRange buff = new SimplePositionedMutableByteRange(limit);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] val : VALUES) {
buff.setPosition(0);
DataType<byte[]> type = new FixedLengthWrapper<byte[]>(new RawBytes(ord), limit);
assertEquals(limit, type.encode(buff, val));
buff.setPosition(0);
byte[] actual = type.decode(buff);
assertTrue("Decoding output differs from expected",
Bytes.equals(val, 0, val.length, actual, 0, val.length));
buff.setPosition(0);
assertEquals(limit, type.skip(buff));
}
}
}
}
示例4: testReadWrite
@Test
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());
}
}
}
示例5: testReadWriteNonSkippable
@Test
public void testReadWriteNonSkippable() {
PositionedByteRange buff = new SimplePositionedByteRange(12);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] term : TERMINATORS) {
for (byte[] val : VALUES_BYTES) {
buff.setPosition(0);
DataType<byte[]> type = new TerminatedWrapper<byte[]>(new RawBytes(ord), term);
assertEquals(val.length + term.length, type.encode(buff, val));
buff.setPosition(0);
assertArrayEquals(val, type.decode(buff));
assertEquals(val.length + term.length, buff.getPosition());
}
}
}
}
示例6: testSkipNonSkippable
@Test
public void testSkipNonSkippable() {
PositionedByteRange buff = new SimplePositionedByteRange(12);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] term : TERMINATORS) {
for (byte[] val : VALUES_BYTES) {
buff.setPosition(0);
DataType<byte[]> type = new TerminatedWrapper<byte[]>(new RawBytes(ord), term);
int expected = type.encode(buff, val);
buff.setPosition(0);
assertEquals(expected, type.skip(buff));
assertEquals(expected, buff.getPosition());
}
}
}
}
示例7: testReadWrite
@Test
public void testReadWrite() {
for (int limit : limits) {
PositionedByteRange buff = new SimplePositionedByteRange(limit);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] val : VALUES) {
buff.setPosition(0);
DataType<byte[]> type = new FixedLengthWrapper<byte[]>(new RawBytes(ord), limit);
assertEquals(limit, type.encode(buff, val));
buff.setPosition(0);
byte[] actual = type.decode(buff);
assertTrue("Decoding output differs from expected",
Bytes.equals(val, 0, val.length, actual, 0, val.length));
buff.setPosition(0);
assertEquals(limit, type.skip(buff));
}
}
}
}
示例8: testReadWrite
@Test
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 SimplePositionedByteRange(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());
}
}
}
示例9: testSkipNonSkippable
@Test
public void testSkipNonSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(12);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] term : TERMINATORS) {
for (byte[] val : VALUES_BYTES) {
buff.setPosition(0);
DataType<byte[]> type = new TerminatedWrapper<>(new RawBytes(ord), term);
int expected = type.encode(buff, val);
buff.setPosition(0);
assertEquals(expected, type.skip(buff));
assertEquals(expected, buff.getPosition());
}
}
}
}
示例10: testReadWrite
@Test
public void testReadWrite() {
for (int limit : limits) {
PositionedByteRange buff = new SimplePositionedByteRange(limit);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] val : VALUES) {
buff.setPosition(0);
DataType<byte[]> type = new FixedLengthWrapper<byte[]>(new RawBytes(ord), limit);
assertEquals(limit, type.encode(buff, val));
byte[] expected = Arrays.copyOf(val, limit);
buff.setPosition(0);
byte[] actual = type.decode(buff);
assertArrayEquals(expected, actual);
buff.setPosition(0);
assertEquals(limit, type.skip(buff));
}
}
}
}
示例11: decode
@Override
public String decode(PositionedByteRange src) {
if (Order.ASCENDING == this.order) {
// avoid unnecessary array copy for ASC case.
String val =
Bytes.toString(src.getBytes(), src.getOffset() + src.getPosition(), src.getRemaining());
src.setPosition(src.getLength());
return val;
} else {
byte[] b = new byte[src.getRemaining()];
src.get(b);
order.apply(b, 0, b.length);
return Bytes.toString(b);
}
}
示例12: encodedLength
@Override
public int encodedLength(byte[] val) {
return null == val ?
(Order.ASCENDING == order ? 1 : 2) :
(Order.ASCENDING == order ? val.length + 1 : val.length + 2);
}
示例13: RawString
protected RawString() {
this.order = Order.ASCENDING;
}
示例14: RawBytes
protected RawBytes() {
this.order = Order.ASCENDING;
}
示例15: RawString
protected RawString() { this.order = Order.ASCENDING; }