Example usage for com.amazonaws.services.s3.model GetObjectRequest withRange

List of usage examples for com.amazonaws.services.s3.model GetObjectRequest withRange

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.model GetObjectRequest withRange.

Prototype

public GetObjectRequest withRange(long start, long end) 

Source Link

Document

Sets the optional inclusive byte range within the desired object that will be downloaded by this request.

Usage

From source file:core.connector.s3.sync.S3Connector.java

License:GNU General Public License

@Override
public byte[] get(String path, long size) throws ConnectorException {
    try {//from   w ww  . j a  va 2 s.com
        GetObjectRequest request = new GetObjectRequest(info.getBucketName(), path);
        if (size >= 0)
            request.withRange(0, size);

        return Streams.readFullyBytes(s3.getObject(request).getObjectContent());
    } catch (Exception e) {
        throw new ConnectorException(e);
    }
}