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);
}
Aggregations