InMemoryReader.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:hadoop 作者:
public boolean nextRawKey(DataInputBuffer key) throws IOException {
  try {
    if (!positionToNextRecord(memDataIn)) {
      return false;
    }
    // Setup the key
    int pos = memDataIn.getPosition();
    byte[] data = memDataIn.getData();
    key.reset(data, pos, currentKeyLength);
    // Position for the next value
    long skipped = memDataIn.skip(currentKeyLength);
    if (skipped != currentKeyLength) {
      throw new IOException("Rec# " + recNo + 
          ": Failed to skip past key of length: " + 
          currentKeyLength);
    }

    // Record the byte
    bytesRead += currentKeyLength;
    return true;
  } catch (IOException ioe) {
    dumpOnError();
    throw ioe;
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号