Java Code Examples for org.apache.parquet.io.DelegatingSeekableInputStream

The following examples show how to use org.apache.parquet.io.DelegatingSeekableInputStream. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: iceberg   Source File: TestMetricsRowGroupFilter.java    License: Apache License 2.0 6 votes vote down vote up
private org.apache.parquet.io.InputFile parquetInputFile(InputFile inFile) {
  return new org.apache.parquet.io.InputFile() {
    @Override
    public long getLength() throws IOException {
      return inFile.getLength();
    }

    @Override
    public org.apache.parquet.io.SeekableInputStream newStream() throws IOException {
      SeekableInputStream stream = inFile.newStream();
      return new DelegatingSeekableInputStream(stream) {
        @Override
        public long getPos() throws IOException {
          return stream.getPos();
        }

        @Override
        public void seek(long newPos) throws IOException {
          stream.seek(newPos);
        }
      };
    }
  };
}
 
Example 2
Source Project: iceberg   Source File: TestMetricsRowGroupFilterTypes.java    License: Apache License 2.0 6 votes vote down vote up
private org.apache.parquet.io.InputFile parquetInputFile(InputFile inFile) {
  return new org.apache.parquet.io.InputFile() {
    @Override
    public long getLength() throws IOException {
      return inFile.getLength();
    }

    @Override
    public org.apache.parquet.io.SeekableInputStream newStream() throws IOException {
      SeekableInputStream stream = inFile.newStream();
      return new DelegatingSeekableInputStream(stream) {
        @Override
        public long getPos() throws IOException {
          return stream.getPos();
        }

        @Override
        public void seek(long newPos) throws IOException {
          stream.seek(newPos);
        }
      };
    }
  };
}
 
Example 3
Source Project: beam   Source File: ParquetIO.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public SeekableInputStream newStream() {
  return new DelegatingSeekableInputStream(Channels.newInputStream(seekableByteChannel)) {

    @Override
    public long getPos() throws IOException {
      return seekableByteChannel.position();
    }

    @Override
    public void seek(long newPos) throws IOException {
      seekableByteChannel.position(newPos);
    }
  };
}