Search in sources :

Example 1 with OSSObject

use of com.aliyun.oss.model.OSSObject in project alluxio by Alluxio.

the class OSSInputStream method createStream.

@Override
protected InputStream createStream(long startPos, long endPos) throws IOException {
    GetObjectRequest req = new GetObjectRequest(mBucketName, mKey);
    // OSS returns entire object if we read past the end
    req.setRange(startPos, endPos < mContentLength ? endPos - 1 : mContentLength - 1);
    OSSObject ossObject = mOssClient.getObject(req);
    return new BufferedInputStream(ossObject.getObjectContent());
}
Also used : OSSObject(com.aliyun.oss.model.OSSObject) BufferedInputStream(java.io.BufferedInputStream) GetObjectRequest(com.aliyun.oss.model.GetObjectRequest)

Aggregations

GetObjectRequest (com.aliyun.oss.model.GetObjectRequest)1 OSSObject (com.aliyun.oss.model.OSSObject)1 BufferedInputStream (java.io.BufferedInputStream)1