appendUserAgent(getObjectRequest, USER_AGENT);
String description = "Downloading from " + getObjectRequest.getBucketName() + "/" + getObjectRequest.getKey();
TransferProgressImpl transferProgress = new TransferProgressImpl();
ProgressListenerChain listenerChain = new ProgressListenerChain(
new TransferProgressUpdatingListener(transferProgress), // The listener for updating transfer progress
getObjectRequest.getGeneralProgressListener()); // Listeners included in the original request
// The listener chain used by the low-level GetObject request.
// This listener chain ignores any COMPLETE event, so that we could
// delay firing the signal until the high-level download fully finishes.
ProgressListenerChain listenerChainForGetObjectRequest = new ProgressListenerChain(
new ProgressEventFilter() {
@Override
public ProgressEvent filter(ProgressEvent progressEvent) {
if (progressEvent.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE) {
// Block COMPLETE events from the low-level GetObject operation,