public static void closeStreamsQuietly(S3Object s3Obj) { if (s3Obj == null) { return; } try { s3Obj.closeDataInputStream(); } catch (IOException e) { } }
@Override public URI call() throws Exception { final S3Coords coords = new S3Coords(checkURI(uri)); long mostRecent = Long.MIN_VALUE; URI latest = null; S3Object[] objects = s3Client.listObjects(coords.bucket, coords.path, null); if (objects == null) { return null; } for (S3Object storageObject : objects) { storageObject.closeDataInputStream(); String keyString = storageObject.getKey().substring(coords.path.length()); if (keyString.startsWith("/")) { keyString = keyString.substring(1); } if (pattern != null && !pattern.matcher(keyString).matches()) { continue; } final long latestModified = storageObject.getLastModifiedDate().getTime(); if (latestModified >= mostRecent) { mostRecent = latestModified; latest = new URI(StringUtils.format("s3://%s/%s", storageObject.getBucketName(), storageObject.getKey())); } } return latest; } },
if (s3Object != null) { try { s3Object.closeDataInputStream(); } catch (IOException e) { throw new StorageResponseHandlingException("Close response data strem IO problem", e);
if (s3Object != null) { try { s3Object.closeDataInputStream(); } catch (IOException e) { throw new StorageResponseHandlingException("Close response data strem IO problem", e);
.getDataInputStream()); in.readFully(data); obj.closeDataInputStream(); if (encrypt) data = EncryptUtils.decrypt(data);
if (partObjects != null && partObjects.size() > 0) { for (S3Object partObject: partObjects) { partObject.closeDataInputStream();
public void run() { try { File underlyingFile = signedUrlAndObject.getObject().getDataInputFile(); if (signedUrlAndObject.getObject().getDataInputStream() != null) { interruptableInputStream = new InterruptableInputStream( signedUrlAndObject.getObject().getDataInputStream()); ProgressMonitoredInputStream pmInputStream = new ProgressMonitoredInputStream( interruptableInputStream, progressMonitor); signedUrlAndObject.getObject().setDataInputStream(pmInputStream); } SignedUrlHandler signedPutUploader = s3Service; result = signedPutUploader.putObjectWithSignedUrl( signedUrlAndObject.getSignedUrl(), signedUrlAndObject.getObject()); if (underlyingFile instanceof TempFile) { underlyingFile.delete(); } } catch (ServiceException se) { result = new S3ServiceException(se); } finally { try { signedUrlAndObject.getObject().closeDataInputStream(); } catch (IOException e) { if (log.isErrorEnabled()) { log.error("Unable to close Object's input stream", e); } } } }
if (partObjects != null && partObjects.size() > 0) { for (S3Object partObject: partObjects) { partObject.closeDataInputStream();
public void run() { try { File underlyingFile = signedUrlAndObject.getObject().getDataInputFile(); if (signedUrlAndObject.getObject().getDataInputStream() != null) { interruptableInputStream = new InterruptableInputStream( signedUrlAndObject.getObject().getDataInputStream()); ProgressMonitoredInputStream pmInputStream = new ProgressMonitoredInputStream( interruptableInputStream, progressMonitor); signedUrlAndObject.getObject().setDataInputStream(pmInputStream); } SignedUrlHandler signedPutUploader = s3Service; result = signedPutUploader.putObjectWithSignedUrl( signedUrlAndObject.getSignedUrl(), signedUrlAndObject.getObject()); if (underlyingFile instanceof TempFile) { underlyingFile.delete(); } } catch (ServiceException se) { result = new S3ServiceException(se); } finally { try { signedUrlAndObject.getObject().closeDataInputStream(); } catch (IOException e) { if (log.isErrorEnabled()) { log.error("Unable to close Object's input stream", e); } } } }
object.closeDataInputStream();