当前位置: 首页>>代码示例>>Java>>正文


Java PositionedByteRange.getRemaining方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.PositionedByteRange.getRemaining方法的典型用法代码示例。如果您正苦于以下问题:Java PositionedByteRange.getRemaining方法的具体用法?Java PositionedByteRange.getRemaining怎么用?Java PositionedByteRange.getRemaining使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.util.PositionedByteRange的用法示例。


在下文中一共展示了PositionedByteRange.getRemaining方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:FixedLengthWrapper.java

示例2: decode

import org.apache.hadoop.hbase.util.PositionedByteRange; //导入方法依赖的package包/类
@Override
public T decode(PositionedByteRange src) {
  if (src.getRemaining() < length) {
    throw new IllegalArgumentException("Not enough buffer remaining. src.offset: "
        + src.getOffset() + " src.length: " + src.getLength() + " src.position: "
        + src.getPosition() + " max length: " + length);
  }
  // create a copy range limited to length bytes. boo.
  PositionedByteRange b = new SimplePositionedMutableByteRange(length);
  src.get(b.getBytes());
  return base.decode(b);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:FixedLengthWrapper.java

示例3: decode

import org.apache.hadoop.hbase.util.PositionedByteRange; //导入方法依赖的package包/类
@Override
public String decode(PositionedByteRange src) {
  if (Order.ASCENDING == this.order) {
    // avoid unnecessary array copy for ASC case.
    String val =
        Bytes.toString(src.getBytes(), src.getOffset() + src.getPosition(), src.getRemaining());
    src.setPosition(src.getLength());
    return val;
  } else {
    byte[] b = new byte[src.getRemaining()];
    src.get(b);
    order.apply(b, 0, b.length);
    return Bytes.toString(b);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:RawString.java

示例4: skip

import org.apache.hadoop.hbase.util.PositionedByteRange; //导入方法依赖的package包/类
@Override
public int skip(PositionedByteRange src) {
  int skipped = src.getRemaining();
  src.setPosition(src.getLength());
  return skipped;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:RawString.java


注:本文中的org.apache.hadoop.hbase.util.PositionedByteRange.getRemaining方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。