Search in sources :

Example 1 with COSInputStream

use of com.ibm.stocator.fs.cos.COSInputStream in project stocator by SparkTC.

the class COSAPIClient method getObject.

@Override
public FSDataInputStream getObject(String hostName, Path path) throws IOException {
    LOG.debug("Opening '{}' for reading.", path);
    String key = pathToKey(path);
    FileStatus fileStatus = memoryCache.getFileStatus(path.toString());
    if (fileStatus == null) {
        fileStatus = getFileStatus(hostName, path, "getObject");
    }
    if (fileStatus.isDirectory()) {
        throw new FileNotFoundException("Can't open " + path + " because it is a directory");
    }
    COSInputStream inputStream = new COSInputStream(mBucket, key, fileStatus.getLen(), mClient, readAhead, inputPolicy, statistics);
    return new FSDataInputStream(inputStream);
}
Also used : FileStatus(org.apache.hadoop.fs.FileStatus) LocatedFileStatus(org.apache.hadoop.fs.LocatedFileStatus) COSInputStream(com.ibm.stocator.fs.cos.COSInputStream) FileNotFoundException(java.io.FileNotFoundException) FSDataInputStream(org.apache.hadoop.fs.FSDataInputStream)

Aggregations

COSInputStream (com.ibm.stocator.fs.cos.COSInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 FSDataInputStream (org.apache.hadoop.fs.FSDataInputStream)1 FileStatus (org.apache.hadoop.fs.FileStatus)1 LocatedFileStatus (org.apache.hadoop.fs.LocatedFileStatus)1