org.apache.hadoop.io.IOUtils.skipFully()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(188)

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

IOUtils.skipFully介绍

[英]Similar to readFully(). Skips bytes in a loop.
[中]类似于readFully()。跳过循环中的字节。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

  1. public void skipDataFully(long len) throws IOException {
  2. IOUtils.skipFully(dataIn, len);
  3. }

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

  1. public void skipChecksumFully(long len) throws IOException {
  2. IOUtils.skipFully(checksumIn, len);
  3. }

代码示例来源:origin: apache/hbase

  1. IOUtils.skipFully(in, whatIsLeftToRead);
  2. if (call != null) {
  3. call.callStats.setResponseSizeBytes(totalSize);

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

  1. IOUtils.skipFully(in, idx);
  2. in.mark(temp.length + 1);
  3. IOUtils.skipFully(in, 1);

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

  1. @Override
  2. public FSEditLogOp decodeOp() throws IOException {
  3. long txid = decodeOpFrame();
  4. if (txid == HdfsServerConstants.INVALID_TXID) {
  5. return null;
  6. }
  7. in.reset();
  8. in.mark(maxOpSize);
  9. FSEditLogOpCodes opCode = FSEditLogOpCodes.fromByte(in.readByte());
  10. FSEditLogOp op = cache.get(opCode);
  11. if (op == null) {
  12. throw new IOException("Read invalid opcode " + opCode);
  13. }
  14. op.setTransactionId(txid);
  15. IOUtils.skipFully(in, 4 + 8); // skip length and txid
  16. op.readFields(in, logVersion);
  17. // skip over the checksum, which we validated above.
  18. IOUtils.skipFully(in, CHECKSUM_LENGTH);
  19. return op;
  20. }

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

  1. IOUtils.skipFully(tracker, skipAmt);

代码示例来源:origin: org.apache.tajo/tajo-storage

  1. private void seekToNextKeyBuffer() throws IOException {
  2. if (!keyInit) {
  3. return;
  4. }
  5. if (!currentValue.inited) {
  6. IOUtils.skipFully(in, currentRecordLength - currentKeyLength);
  7. }
  8. }

代码示例来源:origin: org.apache.tajo/tajo-storage-hdfs

  1. private void seekToNextKeyBuffer() throws IOException {
  2. if (!keyInit) {
  3. return;
  4. }
  5. if (!currentValue.inited) {
  6. IOUtils.skipFully(in, currentRecordLength - currentKeyLength);
  7. }
  8. }

代码示例来源:origin: org.apache.tajo/tajo-storage

  1. private void seekToNextKeyBuffer() throws IOException {
  2. if (!keyInit) {
  3. return;
  4. }
  5. if (!currentValue.inited) {
  6. IOUtils.skipFully(sin, currentRecordLength - currentKeyLength);
  7. }
  8. }

代码示例来源:origin: apache/tajo

  1. private void seekToNextKeyBuffer() throws IOException {
  2. if (!keyInit) {
  3. return;
  4. }
  5. if (!currentValue.inited) {
  6. IOUtils.skipFully(in, currentRecordLength - currentKeyLength);
  7. }
  8. }

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

  1. IOUtils.skipFully(checksumIn, checksumSkip);

代码示例来源:origin: linkedin/dynamometer

  1. @Override // FsDatasetSpi
  2. public synchronized InputStream getBlockInputStream(ExtendedBlock b,
  3. long seekOffset) throws IOException {
  4. InputStream result = getBlockInputStream(b);
  5. IOUtils.skipFully(result, seekOffset);
  6. return result;
  7. }

代码示例来源:origin: org.apache.hbase/hbase-client

  1. IOUtils.skipFully(in, whatIsLeftToRead);
  2. if (call != null) {
  3. call.callStats.setResponseSizeBytes(totalSize);

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs-httpfs

  1. @Override
  2. public void write(OutputStream os) throws IOException {
  3. IOUtils.skipFully(is, offset);
  4. if (len == -1) {
  5. IOUtils.copyBytes(is, os, 4096, true);
  6. } else {
  7. IOUtils.copyBytes(is, os, len, true);
  8. }
  9. }
  10. }

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

  1. private boolean checkUnsupportedMethod(FileSystem fs, Path file,
  2. byte[] expected, int readOffset) throws IOException {
  3. HdfsDataInputStream stm = (HdfsDataInputStream)fs.open(file);
  4. ByteBuffer actual = ByteBuffer.allocateDirect(expected.length - readOffset);
  5. IOUtils.skipFully(stm, readOffset);
  6. try {
  7. stm.read(actual);
  8. } catch(UnsupportedOperationException unex) {
  9. return true;
  10. }
  11. return false;
  12. }

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

  1. @Override // FsDatasetSpi
  2. public synchronized InputStream getBlockInputStream(ExtendedBlock b,
  3. long seekOffset) throws IOException {
  4. InputStream result = getBlockInputStream(b);
  5. IOUtils.skipFully(result, seekOffset);
  6. return result;
  7. }

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

  1. try {
  2. IOUtils.skipFully(dataIn, firstChunkOffset);
  3. if (checksumIn != null) {
  4. long checkSumOffset = (firstChunkOffset / bytesPerChecksum) * checksumSize;
  5. IOUtils.skipFully(checksumIn, checkSumOffset);

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

  1. IOUtils.skipFully(in, length - 8);

代码示例来源:origin: org.hammerlab/hadoop-bam

  1. public long findNextBAMPos(int cp0, int offset)
  2. throws IOException {
  3. try {
  4. long vPos = ((long) cp0 << 16) | offset;
  5. int numTries = 65536;
  6. boolean firstPass = true;
  7. // up: Uncompressed Position, indexes the data inside the BGZF block.
  8. for (int i = 0; i < numTries; i++) {
  9. if (firstPass) {
  10. firstPass = false;
  11. bgzf.seek(vPos);
  12. } else {
  13. bgzf.seek(vPos);
  14. // Increment vPos, possibly over a block boundary
  15. IOUtils.skipFully(bgzf, 1);
  16. vPos = bgzf.getFilePointer();
  17. }
  18. if (!posGuesser.checkRecordStart(vPos)) {
  19. continue;
  20. }
  21. if (posGuesser.checkSucceedingRecords(vPos))
  22. return vPos;
  23. }
  24. } catch (EOFException ignored) {}
  25. return -1;
  26. }

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

  1. private void testSkip1(int skippedBytes)
  2. throws Exception {
  3. long oldPos = stm.getPos();
  4. IOUtils.skipFully(stm, skippedBytes);
  5. long newPos = oldPos + skippedBytes;
  6. assertEquals(stm.getPos(), newPos);
  7. stm.readFully(actual);
  8. checkAndEraseData(actual, (int)newPos, expected, "Read Sanity Test");
  9. }

相关文章