S3Object object = s3Service.getObject(awsBucketName, key); InputStream istream = object.getDataInputStream(); FileOutputStream ostream = new FileOutputStream(path);
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; } }
@Override protected InputStream openObjectStream(S3Object object) throws IOException { try { // Get data of the given object and open an input stream return s3Client.getObject(object.getBucketName(), object.getKey()).getDataInputStream(); } catch (ServiceException e) { throw new IOException(e); } }
@Override public InputStream getInputStream(long offset) throws IOException { try { // Note: do *not* use S3ObjectRandomAccessInputStream if the object is to be read sequentially, as it would // add unnecessary billing overhead since it reads the object chunk by chunk, each in a separate GET request. return service.getObject(bucketName, getObjectKey(false), null, null, null, null, offset==0?null:offset, null).getDataInputStream(); } catch(S3ServiceException e) { throw getIOException(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); } }
protected InputStream getInputStream(S3Object nextFile) throws ServiceException, IOException { return s3.getObject(nextFile.getBucketName(), nextFile.getName()).getDataInputStream(); }
/** * @param key * The key is the object name that is being retrieved from the S3 bucket * @return * This method returns null if the key is not found * @throws IOException */ @Override public InputStream retrieve(String key) throws IOException { try { LOG.debug("Getting key: {} from bucket: {}", key, bucket.getName()); S3Object object = s3Service.getObject(bucket.getName(), key); return object.getDataInputStream(); } catch (ServiceException e) { handleException(e, key); return null; //return null if key not found } }
private InputStream get(String key) throws IOException { try { S3Object object = s3Service.getObject(bucket, key); return object.getDataInputStream(); } catch (S3ServiceException e) { if ("NoSuchKey".equals(e.getS3ErrorCode())) { return null; } if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
private InputStream get(String key) throws IOException { try { S3Object object = s3Service.getObject(bucket, key); return object.getDataInputStream(); } catch (S3ServiceException e) { if ("NoSuchKey".equals(e.getS3ErrorCode())) { return null; } if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public InputStream retrieve(String key) throws IOException { try { S3Object object = s3Service.getObject(bucket, key); return object.getDataInputStream(); } catch (S3ServiceException e) { if ("NoSuchKey".equals(e.getS3ErrorCode())) { return null; } if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public InputStream retrieve(String key) throws IOException { try { S3Object object = s3Service.getObject(bucket, key); return object.getDataInputStream(); } catch (S3ServiceException e) { if ("NoSuchKey".equals(e.getS3ErrorCode())) { return null; } if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
private InputStream get(String key, long byteRangeStart) throws IOException { try { S3Object object = s3Service.getObject(bucket, key, null, null, null, null, byteRangeStart, null); return object.getDataInputStream(); } catch (S3ServiceException e) { if ("NoSuchKey".equals(e.getS3ErrorCode())) { return null; } if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
private InputStream get(String key, long byteRangeStart) throws IOException { try { S3Object object = s3Service.getObject(bucket, key, null, null, null, null, byteRangeStart, null); return object.getDataInputStream(); } catch (S3ServiceException e) { if ("NoSuchKey".equals(e.getS3ErrorCode())) { return null; } if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public InputStream retrieve(String key, long byteRangeStart) throws IOException { try { S3Object object = s3Service.getObject(bucket, key, null, null, null, null, byteRangeStart, null); return object.getDataInputStream(); } catch (S3ServiceException e) { if ("NoSuchKey".equals(e.getS3ErrorCode())) { return null; } if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public InputStream retrieve(String key, long byteRangeStart) throws IOException { try { S3Object object = s3Service.getObject(bucket, key, null, null, null, null, byteRangeStart, null); return object.getDataInputStream(); } catch (S3ServiceException e) { if ("NoSuchKey".equals(e.getS3ErrorCode())) { return null; } if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
private InputStream get(String key) throws IOException { try { S3Object object = s3Service.getObject(bucket.getName(), key); return object.getDataInputStream(); } catch (S3ServiceException e) { if ("NoSuchKey".equals(e.getS3ErrorCode())) { return null; } if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } catch (ServiceException e) { return null; } }
private InputStream get(String key, long byteRangeStart) throws IOException { try { S3Object object = s3Service.getObject(bucket, key, null, null, null, null, byteRangeStart, null); return object.getDataInputStream(); } catch (S3ServiceException e) { if ("NoSuchKey".equals(e.getS3ErrorCode())) { return null; } if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } catch (ServiceException e) { handleServiceException(e); return null; } }
@Override protected InputStream createData() throws IOException { RestS3Service service = null; try { service = new RestS3Service(new AWSCredentials(getAccess(), getSecret())); S3Object object = service.getObject(getBucket(), getPath()); return new ServiceInputStream(service, object.getDataInputStream()); } catch (ServiceException ex) { throw new IOException(String.format("Unable to store [%s] file!", getPath()), ex); } }