Example usage for org.apache.hadoop.fs FileContext open

List of usage examples for org.apache.hadoop.fs FileContext open

Introduction

In this page you can find the example usage for org.apache.hadoop.fs FileContext open.

Prototype

public FSDataInputStream open(final Path f, final int bufferSize)
        throws AccessControlException, FileNotFoundException, UnsupportedFileSystemException, IOException 

Source Link

Document

Opens an FSDataInputStream at the indicated Path.

Usage

From source file:org.elasticsearch.repositories.hdfs.HdfsBlobContainer.java

License:Apache License

@Override
public InputStream readBlob(String blobName) throws IOException {
    if (!blobExists(blobName)) {
        throw new NoSuchFileException("Blob [" + blobName + "] does not exist");
    }//from   w w w .  ja  va 2 s  .  c om
    // FSDataInputStream does buffering internally
    return store.execute(new Operation<InputStream>() {
        @Override
        public InputStream run(FileContext fileContext) throws IOException {
            return fileContext.open(new Path(path, blobName), bufferSize);
        }
    });
}