本文整理了Java中org.apache.fluo.api.data.Bytes.byteAt()
方法的一些代码示例,展示了Bytes.byteAt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.byteAt()
方法的具体详情如下:
包路径:org.apache.fluo.api.data.Bytes
类名称:Bytes
方法名:byteAt
[英]Gets a byte within this sequence of bytes
[中]获取此字节序列中的一个字节
代码示例来源:origin: org.apache.fluo/fluo-recipes-core
private static long decodeSeq(Bytes seq) {
return (((long) seq.byteAt(0) << 56) + ((long) (seq.byteAt(1) & 255) << 48)
+ ((long) (seq.byteAt(2) & 255) << 40) + ((long) (seq.byteAt(3) & 255) << 32)
+ ((long) (seq.byteAt(4) & 255) << 24) + ((seq.byteAt(5) & 255) << 16)
+ ((seq.byteAt(6) & 255) << 8) + ((seq.byteAt(7) & 255) << 0));
}
代码示例来源:origin: org.apache.fluo/fluo-recipes-test
public static void encNonAscii(StringBuilder sb, Bytes bytes) {
for (int i = 0; i < bytes.length(); i++) {
byte b = bytes.byteAt(i);
if (b >= 32 && b <= 126 && b != '\\') {
sb.append((char) b);
} else {
sb.append(String.format("\\x%02x", b & 0xff));
}
}
}
代码示例来源:origin: org.apache.fluo/fluo-core
public static void encNonAscii(StringBuilder sb, Bytes bytes) {
if (bytes == null) {
sb.append("null");
} else {
for (int i = 0; i < bytes.length(); i++) {
byte b = bytes.byteAt(i);
if (b >= 32 && b <= 126 && b != '\\') {
sb.append((char) b);
} else {
sb.append(String.format("\\x%02x", b & 0xff));
}
}
}
}
代码示例来源:origin: org.apache.fluo/fluo-recipes-core
private static void encNonAscii(StringBuilder sb, Bytes bytes) {
if (bytes == null) {
sb.append("null");
} else {
for (int i = 0; i < bytes.length(); i++) {
byte b = bytes.byteAt(i);
if (b >= 32 && b <= 126 && b != '\\') {
sb.append((char) b);
} else {
sb.append(String.format("\\x%02x", b & 0xff));
}
}
}
}
代码示例来源:origin: apache/fluo
public LockValue(byte[] enc) {
List<Bytes> fields = ByteArrayUtil.split(enc);
if (fields.size() != 6) {
throw new IllegalArgumentException("more fields than expected");
}
this.prow = fields.get(0);
this.pcol = new Column(fields.get(1), fields.get(2), fields.get(3));
this.isWrite = (fields.get(4).byteAt(0) & 0x1) == 0x1;
this.isDelete = (fields.get(4).byteAt(0) & 0x2) == 0x2;
this.isTrigger = (fields.get(4).byteAt(0) & 0x4) == 0x4;
this.transactor = ByteArrayUtil.decodeLong(fields.get(5).toArray());
}
代码示例来源:origin: org.apache.fluo/fluo-core
private String encodeColumnFamily(Bytes cf) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < cf.length(); i++) {
int c = 0xff & cf.byteAt(i);
if (c == '\\') {
sb.append("\\\\");
} else if (c >= 32 && c <= 126 && c != ',') {
sb.append((char) c);
} else {
sb.append("\\x").append(String.format("%02X", c));
}
}
return sb.toString();
}
代码示例来源:origin: apache/fluo
public static void encNonAscii(StringBuilder sb, Bytes bytes) {
if (bytes == null) {
sb.append("null");
} else {
for (int i = 0; i < bytes.length(); i++) {
byte b = bytes.byteAt(i);
if (b >= 32 && b <= 126 && b != '\\') {
sb.append((char) b);
} else {
sb.append(String.format("\\x%02x", b & 0xff));
}
}
}
}
代码示例来源:origin: org.apache.fluo/fluo-recipes-core
private boolean hasHash(Bytes row) {
for (int i = prefixBytes.length(); i < prefixBytes.length() + HASH_LEN; i++) {
byte b = row.byteAt(i);
boolean isAlphaNum = (b >= 'a' && b <= 'z') || (b >= '0' && b <= '9');
if (!isAlphaNum) {
return false;
}
}
if (row.byteAt(prefixBytes.length() - 1) != ':'
|| row.byteAt(prefixBytes.length() + HASH_LEN) != ':') {
return false;
}
return true;
}
代码示例来源:origin: apache/incubator-rya
private static boolean hasHash(Bytes prefixBytes, Bytes row) {
for (int i = prefixBytes.length() + 1; i < prefixBytes.length() + HASH_LEN; i++) {
byte b = row.byteAt(i);
boolean isAlphaNum = (b >= 'a' && b <= 'z') || (b >= '0' && b <= '9');
if (!isAlphaNum) {
return false;
}
}
if (row.byteAt(prefixBytes.length()) != ':' || row.byteAt(prefixBytes.length() + HASH_LEN + 1) != ':') {
return false;
}
return true;
}
代码示例来源:origin: org.apache.rya/rya.pcj.fluo.app
private static boolean hasHash(Bytes prefixBytes, Bytes row) {
for (int i = prefixBytes.length() + 1; i < prefixBytes.length() + HASH_LEN; i++) {
byte b = row.byteAt(i);
boolean isAlphaNum = (b >= 'a' && b <= 'z') || (b >= '0' && b <= '9');
if (!isAlphaNum) {
return false;
}
}
if (row.byteAt(prefixBytes.length()) != ':' || row.byteAt(prefixBytes.length() + HASH_LEN + 1) != ':') {
return false;
}
return true;
}
代码示例来源:origin: apache/fluo
public static void encNonAscii(StringBuilder sb, Bytes bytes) {
for (int i = 0; i < bytes.length(); i++) {
appendByte(sb, bytes.byteAt(i));
}
}
代码示例来源:origin: org.apache.fluo/fluo-recipes-core
ExportBucket(TransactionBase tx, Bytes bucketRow) {
this.ttx = new TypeLayer(new StringEncoder()).wrap(tx);
int colonLoc = -1;
for (int i = 0; i < bucketRow.length(); i++) {
if (bucketRow.byteAt(i) == ':') {
colonLoc = i;
break;
}
}
Preconditions.checkArgument(colonLoc != -1 && colonLoc != bucketRow.length(),
"Invalid bucket row " + bucketRow);
Preconditions.checkArgument(bucketRow.byteAt(bucketRow.length() - 1) == ':',
"Invalid bucket row " + bucketRow);
this.bucketRow = bucketRow.subSequence(0, bucketRow.length() - 1);
this.qid = bucketRow.subSequence(0, colonLoc).toString();
}
内容来源于网络,如有侵权,请联系作者删除!