protected static IOException getIOException(S3ServiceException e, FileURL fileURL) throws IOException { handleAuthException(e, fileURL); Throwable cause = e.getCause(); if(cause instanceof IOException) return (IOException)cause; if(JavaVersion.JAVA_1_6.isCurrentOrHigher()) return new IOException(e); return new IOException(e.getMessage()); }
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) 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 void purge(String prefix) throws IOException { try { S3Object[] objects = s3Service.listObjects(bucket, prefix, null); for (int i = 0; i < objects.length; i++) { s3Service.deleteObject(bucket, objects[i].getKey()); } } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public void purge(String prefix) throws IOException { try { S3Object[] objects = s3Service.listObjects(bucket, prefix, null); for (int i = 0; i < objects.length; i++) { s3Service.deleteObject(bucket, objects[i].getKey()); } } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public void purge() throws IOException { try { S3Object[] objects = s3Service.listObjects(bucket); for (int i = 0; i < objects.length; i++) { s3Service.deleteObject(bucket, objects[i].getKey()); } } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public void purge() throws IOException { try { S3Object[] objects = s3Service.listObjects(bucket); for (int i = 0; i < objects.length; i++) { s3Service.deleteObject(bucket, objects[i].getKey()); } } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public void rename(String srcKey, String dstKey) throws IOException { try { s3Service.moveObject(bucket.getName(), srcKey, bucket.getName(), new S3Object(dstKey), false); } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public void rename(String srcKey, String dstKey) throws IOException { try { s3Service.moveObject(bucket.getName(), srcKey, bucket.getName(), new S3Object(dstKey), false); } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }
public void storeEmptyFile(String key) throws IOException { try { S3Object object = new S3Object(key); object.setDataInputStream(new ByteArrayInputStream(new byte[0])); object.setContentType("binary/octet-stream"); object.setContentLength(0); s3Service.putObject(bucket, object); } catch (S3ServiceException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new S3Exception(e); } }