CosNInputStream extends FSInputStream { @Override public long getPos() { return this.position; } CosNInputStream(Configuration conf, NativeFileSystemStore store,
      FileSystem.Statistics statistics, String key, long fileSize,
      ExecutorService readAheadExecutorService); @Override void seek(long pos); @Override long getPos(); @Override boolean seekToNewSource(long targetPos); @Override int read(); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close();  }
@Test public void testGetPos() throws Exception { Path seekTestFilePath = new Path(this.testRootDir + "/" + "seekTestFile"); long fileSize = 5 * Unit.MB; ContractTestUtils.generateTestFile( this.fs, seekTestFilePath, fileSize, 256, 255); LOG.info("5MB file for getPos test has created."); FSDataInputStream inputStream = this.fs.open(seekTestFilePath); Random random = new Random(); long pos = Math.abs(random.nextLong()) % fileSize; inputStream.seek(pos); assertTrue("expected position at: " + pos + ", but got: " + inputStream.getPos(), inputStream.getPos() == pos); LOG.info("completed get pos tests."); }