本文整理了Java中org.apache.hadoop.hbase.util.Bytes.incrementBytes()
方法的一些代码示例,展示了Bytes.incrementBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.incrementBytes()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.util.Bytes
类名称:Bytes
方法名:incrementBytes
[英]Bytewise binary increment/deincrement of long contained in byte array on given amount.
[中]字节数组中包含的long在给定数量上的字节二进制增量/增量。
代码示例来源:origin: apache/hbase
private static boolean checkTestIncrementBytes(long val, long amount)
throws IOException {
byte[] value = Bytes.toBytes(val);
byte [] testValue = {-1, -1, -1, -1, -1, -1, -1, -1};
if (value[0] > 0) {
testValue = new byte[Bytes.SIZEOF_LONG];
}
System.arraycopy(value, 0, testValue, testValue.length - value.length,
value.length);
long incrementResult = Bytes.toLong(Bytes.incrementBytes(value, amount));
return (Bytes.toLong(testValue) + amount) == incrementResult;
}
代码示例来源:origin: apache/hbase
startRow = new byte[] { 0, 0, 0, 0, 1 };
byte[] row = Bytes.incrementBytes(startRow, counts[i % n]);
row = Arrays.copyOfRange(row, 3, 8); // use last 5 bytes because
代码示例来源:origin: NGDATA/lilyproject
/**
* Get the next OCC (Optimistic Concurrency Control) value, or an initialized occ value if the current
* value is null.
*
* The handling of null values is needed for working with repositories that were created before the OCC
* was in place.
*
* @param occValue current occ value
*/
protected static byte[] nextOcc(byte[] occValue) {
if (occValue == null) {
return Bytes.toBytes(1L);
}
byte[] newOcc = new byte[occValue.length];
System.arraycopy(occValue, 0, newOcc, 0, occValue.length);
return Bytes.incrementBytes(newOcc, 1L);
}
代码示例来源:origin: org.apache.hbase/hbase-common
private static boolean checkTestIncrementBytes(long val, long amount)
throws IOException {
byte[] value = Bytes.toBytes(val);
byte [] testValue = {-1, -1, -1, -1, -1, -1, -1, -1};
if (value[0] > 0) {
testValue = new byte[Bytes.SIZEOF_LONG];
}
System.arraycopy(value, 0, testValue, testValue.length - value.length,
value.length);
long incrementResult = Bytes.toLong(Bytes.incrementBytes(value, amount));
return (Bytes.toLong(testValue) + amount) == incrementResult;
}
代码示例来源:origin: com.aliyun.hbase/alihbase-common
private static boolean checkTestIncrementBytes(long val, long amount)
throws IOException {
byte[] value = Bytes.toBytes(val);
byte [] testValue = {-1, -1, -1, -1, -1, -1, -1, -1};
if (value[0] > 0) {
testValue = new byte[Bytes.SIZEOF_LONG];
}
System.arraycopy(value, 0, testValue, testValue.length - value.length,
value.length);
long incrementResult = Bytes.toLong(Bytes.incrementBytes(value, amount));
return (Bytes.toLong(testValue) + amount) == incrementResult;
}
代码示例来源:origin: org.apache.hbase/hbase-server
startRow = new byte[] { 0, 0, 0, 0, 1 };
byte[] row = Bytes.incrementBytes(startRow, counts[i % n]);
row = Arrays.copyOfRange(row, 3, 8); // use last 5 bytes because
内容来源于网络,如有侵权,请联系作者删除!