Example usage for com.amazonaws.services.s3.model UploadPartResult setPartNumber

List of usage examples for com.amazonaws.services.s3.model UploadPartResult setPartNumber

Introduction

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

Prototype

public void setPartNumber(int partNumber) 

Source Link

Document

Sets the part number of the newly uploaded part.

Usage

From source file:com.netflix.exhibitor.core.backup.s3.MockS3Client.java

License:Apache License

@Override
public synchronized UploadPartResult uploadPart(UploadPartRequest request) throws Exception {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ByteStreams.copy(request.getInputStream(), out);

    uploadedBytes.add(out.toByteArray());

    byte[] md5bytes = S3Utils.md5(out.toByteArray(), out.size());

    UploadPartResult result = new UploadPartResult();
    result.setPartNumber(request.getPartNumber());
    result.setETag(S3Utils.toHex(md5bytes));
    return result;
}