本文整理汇总了Java中org.apache.hadoop.hbase.util.PositionedByteRange.put方法的典型用法代码示例。如果您正苦于以下问题:Java PositionedByteRange.put方法的具体用法?Java PositionedByteRange.put怎么用?Java PositionedByteRange.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.util.PositionedByteRange
的用法示例。
在下文中一共展示了PositionedByteRange.put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encode
import org.apache.hadoop.hbase.util.PositionedByteRange; //导入方法依赖的package包/类
@Override
public int encode(PositionedByteRange dst, T val) {
if (dst.getRemaining() < length) {
throw new IllegalArgumentException("Not enough buffer remaining. dst.offset: "
+ dst.getOffset() + " dst.length: " + dst.getLength() + " dst.position: "
+ dst.getPosition() + " max length: " + length);
}
int written = base.encode(dst, val);
if (written > length) {
throw new IllegalArgumentException("Length of encoded value (" + written
+ ") exceeds max length (" + length + ").");
}
// TODO: is the zero-padding appropriate?
for (; written < length; written++) { dst.put((byte) 0x00); }
return written;
}
示例2: encode
import org.apache.hadoop.hbase.util.PositionedByteRange; //导入方法依赖的package包/类
@Override
public int encode(PositionedByteRange dst, String val) {
byte[] s = Bytes.toBytes(val);
order.apply(s);
dst.put(s);
return s.length;
}
示例3: encode
import org.apache.hadoop.hbase.util.PositionedByteRange; //导入方法依赖的package包/类
/**
* Write instance {@code val} into buffer {@code dst}.
* @throws IllegalArgumentException when the encoded representation of
* {@code val} contains the {@code term} sequence.
*/
@Override
public int encode(PositionedByteRange dst, T val) {
final int start = dst.getPosition();
int written = wrapped.encode(dst, val);
PositionedByteRange b = dst.shallowCopy();
b.setLength(dst.getPosition());
b.setPosition(start);
if (-1 != terminatorPosition(b)) {
dst.setPosition(start);
throw new IllegalArgumentException("Encoded value contains terminator sequence.");
}
dst.put(term);
return written + term.length;
}