本文整理匯總了Java中org.apache.kylin.common.util.BytesUtil.writeShort方法的典型用法代碼示例。如果您正苦於以下問題:Java BytesUtil.writeShort方法的具體用法?Java BytesUtil.writeShort怎麽用?Java BytesUtil.writeShort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.kylin.common.util.BytesUtil
的用法示例。
在下文中一共展示了BytesUtil.writeShort方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRowKeysDifferentShards
import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
private List<byte[]> getRowKeysDifferentShards(byte[] halfCookedKey) {
final short cuboidShardNum = cubeSeg.getCuboidShardNum(cuboid.getId());
if (!cubeSeg.isEnableSharding()) {
return Lists.newArrayList(halfCookedKey);//not shard to append at head, so it is already well cooked
} else {
List<byte[]> ret = Lists.newArrayList();
for (short i = 0; i < cuboidShardNum; ++i) {
short shard = ShardingHash.normalize(cubeSeg.getCuboidBaseShard(cuboid.getId()), i, cubeSeg.getTotalShards(cuboid.getId()));
byte[] cookedKey = Arrays.copyOf(halfCookedKey, halfCookedKey.length);
BytesUtil.writeShort(shard, cookedKey, 0, RowConstants.ROWKEY_SHARDID_LEN);
ret.add(cookedKey);
}
return ret;
}
}
示例2: fillHeader
import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
protected void fillHeader(byte[] bytes) {
int offset = 0;
if (enableSharding) {
short shard = calculateShard(bytes);
BytesUtil.writeShort(shard, bytes, offset, RowConstants.ROWKEY_SHARDID_LEN);
offset += RowConstants.ROWKEY_SHARDID_LEN;
}
System.arraycopy(cuboid.getBytes(), 0, bytes, offset, RowConstants.ROWKEY_CUBOIDID_LEN);
//offset += RowConstants.ROWKEY_CUBOIDID_LEN;
//return offset;
}