/** * Constructs an input stream based on an {@link HttpResponse} object representing an HTTP connection. * If a connection input stream is available, this constructor wraps the underlying input stream * in an {@link InterruptableInputStream} and makes that stream available. If no underlying connection * is available, an empty {@link ByteArrayInputStream} is made available. * * @param httpMethod */ public HttpMethodReleaseInputStream(HttpResponse httpMethod) { this.httpResponse = httpMethod; try { this.inputStream = new InterruptableInputStream(httpMethod.getEntity().getContent()); } catch (IOException e) { if (log.isWarnEnabled()) { log.warn("Unable to obtain HttpMethod's response data stream", e); } try { EntityUtils.consume(httpMethod.getEntity()); } catch (Exception ee){ // ignore } this.inputStream = new ByteArrayInputStream(new byte[] {}); // Empty input stream; } }
/** * Constructs an input stream based on an {@link HttpResponse} object representing an HTTP connection. * If a connection input stream is available, this constructor wraps the underlying input stream * in an {@link InterruptableInputStream} and makes that stream available. If no underlying connection * is available, an empty {@link ByteArrayInputStream} is made available. * * @param httpMethod */ public HttpMethodReleaseInputStream(HttpResponse httpMethod) { this.httpResponse = httpMethod; try { this.inputStream = new InterruptableInputStream(httpMethod.getEntity().getContent()); } catch (IOException e) { if (log.isWarnEnabled()) { log.warn("Unable to obtain HttpMethod's response data stream", e); } try { EntityUtils.consume(httpMethod.getEntity()); } catch (Exception ee){ // ignore } this.inputStream = new ByteArrayInputStream(new byte[] {}); // Empty input stream; } }
public void run() { try { File underlyingFile = object.getDataInputFile(); if (object.getDataInputStream() != null) { interruptableInputStream = new InterruptableInputStream(object.getDataInputStream()); ProgressMonitoredInputStream pmInputStream = new ProgressMonitoredInputStream( interruptableInputStream, progressMonitor); object.setDataInputStream(pmInputStream); } result = storageService.putObject(bucketName, object); if (underlyingFile instanceof TempFile) { underlyingFile.delete(); } } catch (ServiceException e) { result = e; } }
public void run() { try { File underlyingFile = object.getDataInputFile(); if (object.getDataInputStream() != null) { interruptableInputStream = new InterruptableInputStream(object.getDataInputStream()); ProgressMonitoredInputStream pmInputStream = new ProgressMonitoredInputStream( interruptableInputStream, progressMonitor); object.setDataInputStream(pmInputStream); } result = storageService.putObject(bucketName, object); if (underlyingFile instanceof TempFile) { underlyingFile.delete(); } } catch (ServiceException e) { result = e; } }
public void run() { try { if (object.getDataInputStream() != null) { interruptableInputStream = new InterruptableInputStream(object.getDataInputStream()); ProgressMonitoredInputStream pmInputStream = new ProgressMonitoredInputStream( interruptableInputStream, progressMonitor); object.setDataInputStream(pmInputStream); } ((S3Service)storageService).multipartUploadPart( multipartUpload, partNumber, object); result = object; } catch (ServiceException e) { result = e; } }
public void run() { try { if (object.getDataInputStream() != null) { interruptableInputStream = new InterruptableInputStream(object.getDataInputStream()); ProgressMonitoredInputStream pmInputStream = new ProgressMonitoredInputStream( interruptableInputStream, progressMonitor); object.setDataInputStream(pmInputStream); } ((S3Service)storageService).multipartUploadPart( multipartUpload, partNumber, object); result = object; } catch (ServiceException e) { result = e; } }
public void run() { try { File underlyingFile = s3Object.getDataInputFile(); if (s3Object.getDataInputStream() != null) { interruptableInputStream = new InterruptableInputStream(s3Object.getDataInputStream()); ProgressMonitoredInputStream pmInputStream = new ProgressMonitoredInputStream( interruptableInputStream, progressMonitor); s3Object.setDataInputStream(pmInputStream); } result = s3Service.putObject(bucket, s3Object); if (underlyingFile instanceof TempFile) { underlyingFile.delete(); } } catch (ServiceException se) { result = new S3ServiceException(se); } }
public void run() { try { File underlyingFile = s3Object.getDataInputFile(); if (s3Object.getDataInputStream() != null) { interruptableInputStream = new InterruptableInputStream(s3Object.getDataInputStream()); ProgressMonitoredInputStream pmInputStream = new ProgressMonitoredInputStream( interruptableInputStream, progressMonitor); s3Object.setDataInputStream(pmInputStream); } result = s3Service.putObject(bucket, s3Object); if (underlyingFile instanceof TempFile) { underlyingFile.delete(); } } catch (ServiceException se) { result = new S3ServiceException(se); } }
interruptableInputStream = new InterruptableInputStream(object.getDataInputStream()); bufferedInputStream = new BufferedInputStream( new ProgressMonitoredInputStream(interruptableInputStream, progressMonitor));
interruptableInputStream = new InterruptableInputStream(object.getDataInputStream()); bufferedInputStream = new BufferedInputStream( new ProgressMonitoredInputStream(interruptableInputStream, progressMonitor));
interruptableInputStream = new InterruptableInputStream(object.getDataInputStream()); bufferedInputStream = new BufferedInputStream( new ProgressMonitoredInputStream(interruptableInputStream, progressMonitor));
interruptableInputStream = new InterruptableInputStream(object.getDataInputStream()); bufferedInputStream = new BufferedInputStream( new ProgressMonitoredInputStream(interruptableInputStream, progressMonitor));
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); } } } }
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); } } } }