org.apache.fluo.api.data.Bytes.subSequence()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(74)

本文整理了Java中org.apache.fluo.api.data.Bytes.subSequence()方法的一些代码示例,展示了Bytes.subSequence()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.subSequence()方法的具体详情如下:
包路径:org.apache.fluo.api.data.Bytes
类名称:Bytes
方法名:subSequence

Bytes.subSequence介绍

[英]Returns a portion of the Bytes object
[中]返回字节对象的一部分

代码示例

代码示例来源:origin: org.apache.fluo/fluo-recipes-core

private Bytes getKeyFromUpdateRow(Bytes prefix, Bytes row) {
 return row.subSequence(prefix.length(), row.length() - 8);
}

代码示例来源:origin: org.apache.rya/rya.pcj.fluo.app

/**
   * Removes the triple prefix and returns the new value as a byte array.
   * @param prefixedTriple - serialized RyaStatement with prepended triple prefix, converted to Bytes
   * @return - serialized {@link RyaStatement} in byte array form
   */
  public static byte[] removeTriplePrefixAndConvertToByteArray(Bytes prefixedTriple) {
    checkNotNull(prefixedTriple);
    return prefixedTriple.subSequence(TRIPLE_PREFIX_BYTES.length(), prefixedTriple.length()).toArray();
  }
}

代码示例来源:origin: org.apache.fluo/fluo-recipes-core

/**
 * @return Returns input with prefix and hash stripped from beginning.
 */
public Bytes removeHash(Bytes row) {
 Preconditions.checkArgument(row.length() >= prefixBytes.length() + 5,
   "Row is shorter than expected " + row);
 Preconditions.checkArgument(row.subSequence(0, prefixBytes.length()).equals(prefixBytes),
   "Row does not have expected prefix " + row);
 Preconditions.checkArgument(hasHash(row), "Row does not have expected hash " + row);
 return row.subSequence(prefixBytes.length() + 5, row.length());
}

代码示例来源:origin: apache/incubator-rya

/**
   * Removes the triple prefix and returns the new value as a byte array.
   * @param prefixedTriple - serialized RyaStatement with prepended triple prefix, converted to Bytes
   * @return - serialized {@link RyaStatement} in byte array form
   */
  public static byte[] removeTriplePrefixAndConvertToByteArray(Bytes prefixedTriple) {
    checkNotNull(prefixedTriple);
    return prefixedTriple.subSequence(TRIPLE_PREFIX_BYTES.length(), prefixedTriple.length()).toArray();
  }
}

代码示例来源:origin: apache/incubator-rya

/**
 * @return Returns input with prefix and hash stripped from beginning.
 */
public static Bytes removeHash(Bytes prefixBytes, Bytes row) {
  checkNotNull(prefixBytes);
  checkNotNull(row);
  checkArgument(row.length() >= prefixBytes.length() + 6, "Row is shorter than expected " + row);
  checkArgument(row.subSequence(0, prefixBytes.length()).equals(prefixBytes),
      "Row does not have expected prefix " + row);
  checkArgument(hasHash(prefixBytes, row), "Row does not have expected hash " + row);
  BytesBuilder builder = Bytes.builder();
  builder.append(prefixBytes);
  builder.append("_");
  builder.append(row.subSequence(prefixBytes.length() + 6, row.length()));
  return builder.toBytes();
}

代码示例来源:origin: org.apache.fluo/fluo-recipes-core

@Override
public ExportEntry next() {
 RowColumnValue rowColVal = rowIter.next();
 Bytes row = rowColVal.getRow();
 Bytes keyBytes = row.subSequence(bucketRow.length() + 1, row.length() - 8);
 Bytes seqBytes = row.subSequence(row.length() - 8, row.length());
 ExportEntry ee = new ExportEntry();
 ee.key = keyBytes.toArray();
 ee.seq = decodeSeq(seqBytes);
 // TODO maybe leave as Bytes?
 ee.value = rowColVal.getValue().toArray();
 lastRow = row;
 return ee;
}

代码示例来源:origin: org.apache.rya/rya.pcj.fluo.app

/**
 * @return Returns input with prefix and hash stripped from beginning.
 */
public static Bytes removeHash(Bytes prefixBytes, Bytes row) {
  checkNotNull(prefixBytes);
  checkNotNull(row);
  checkArgument(row.length() >= prefixBytes.length() + 6, "Row is shorter than expected " + row);
  checkArgument(row.subSequence(0, prefixBytes.length()).equals(prefixBytes),
      "Row does not have expected prefix " + row);
  checkArgument(hasHash(prefixBytes, row), "Row does not have expected hash " + row);
  BytesBuilder builder = Bytes.builder();
  builder.append(prefixBytes);
  builder.append("_");
  builder.append(row.subSequence(prefixBytes.length() + 6, row.length()));
  return builder.toBytes();
}

代码示例来源: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();
}

代码示例来源:origin: org.apache.fluo/fluo-recipes-core

rowBuilder.append(ntfyRow.subSequence(updatePrefix.length(), ntfyRow.length()));
int rowPrefixLen = rowBuilder.getLength();

相关文章