co.cask.cdap.api.common.Bytes.tail()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(67)

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

Bytes.tail介绍

[英]Returns last length bytes from byte array.
[中]返回字节数组中最后的length个字节。

代码示例

代码示例来源:origin: cdapio/cdap

@Override
public byte[] next() {
 this.i++;
 if (this.i == 0) {
  return a;
 }
 if (this.i == num + 1) {
  return b;
 }
 BigInteger curBI = startBI.add(intervalBI.multiply(BigInteger.valueOf(this.i)));
 byte [] padded = curBI.toByteArray();
 if (padded[1] == 0) {
  padded = tail(padded, padded.length - 2);
 } else {
  padded = tail(padded, padded.length - 1);
 }
 return padded;
}

代码示例来源:origin: co.cask.cdap/cdap-api-common

@Override
public byte[] next() {
 this.i++;
 if (this.i == 0) {
  return a;
 }
 if (this.i == num + 1) {
  return b;
 }
 BigInteger curBI = startBI.add(intervalBI.multiply(BigInteger.valueOf(this.i)));
 byte [] padded = curBI.toByteArray();
 if (padded[1] == 0) {
  padded = tail(padded, padded.length - 2);
 } else {
  padded = tail(padded, padded.length - 1);
 }
 return padded;
}

代码示例来源:origin: cdapio/cdap

static byte[] keyForBound(long value) {
  byte[] bytes = Bytes.tail(Bytes.toBytes(value), Bytes.SIZEOF_LONG - 1);
  int lastNonZero = bytes.length - 1;
  while (lastNonZero > 0 && bytes[lastNonZero] == 0) {
   lastNonZero--;
  }
  return Bytes.head(bytes, lastNonZero + 1);
 }
}

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

static byte[] keyForBound(long value) {
  byte[] bytes = Bytes.tail(Bytes.toBytes(value), Bytes.SIZEOF_LONG - 1);
  int lastNonZero = bytes.length - 1;
  while (lastNonZero > 0 && bytes[lastNonZero] == 0) {
   lastNonZero--;
  }
  return Bytes.head(bytes, lastNonZero + 1);
 }
}

相关文章