Package loci.common.services
Class S3ClientServiceImpl
java.lang.Object
loci.common.services.AbstractService
loci.common.services.S3ClientServiceImpl
- All Implemented Interfaces:
S3ClientService
,Service
public class S3ClientServiceImpl extends AbstractService implements S3ClientService
An S3 client
-
Constructor Summary
Constructors Constructor Description S3ClientServiceImpl()
Default constructor. -
Method Summary
Modifier and Type Method Description boolean
bucketExists(java.lang.String bucket)
Check whether a bucket existsjava.io.InputStream
getObject(java.lang.String bucket, java.lang.String object, long offset)
Read an objectvoid
getObject(java.lang.String bucket, java.lang.String object, java.lang.String filename)
Download an objectvoid
initialize(java.lang.String server, int port, java.lang.String accessKey, java.lang.String secretKey, java.lang.String appName, java.lang.String appVersion)
Initialise the S3 clientS3ClientStat
statObject(java.lang.String bucket, java.lang.String object)
Stat the object
-
Constructor Details
-
S3ClientServiceImpl
public S3ClientServiceImpl()Default constructor.
-
-
Method Details
-
initialize
public void initialize(java.lang.String server, int port, java.lang.String accessKey, java.lang.String secretKey, java.lang.String appName, java.lang.String appVersion) throws S3ClientServiceExceptionDescription copied from interface:S3ClientService
Initialise the S3 client- Specified by:
initialize
in interfaceS3ClientService
- Parameters:
server
- servernameport
- portaccessKey
- access keysecretKey
- secret keyappName
- user agent application nameappVersion
- user agent application version- Throws:
S3ClientServiceException
- if an S3 error occurred
-
bucketExists
public boolean bucketExists(java.lang.String bucket) throws S3ClientServiceException, java.io.IOExceptionDescription copied from interface:S3ClientService
Check whether a bucket exists- Specified by:
bucketExists
in interfaceS3ClientService
- Parameters:
bucket
- Bucket name- Returns:
- true if bucket exists
- Throws:
S3ClientServiceException
- if an S3 error occurredjava.io.IOException
- if an S3 error occurred
-
statObject
public S3ClientStat statObject(java.lang.String bucket, java.lang.String object) throws S3ClientServiceException, java.io.IOExceptionDescription copied from interface:S3ClientService
Stat the object- Specified by:
statObject
in interfaceS3ClientService
- Parameters:
bucket
- Bucket nameobject
- Object path- Returns:
- S3ClientStat object
- Throws:
S3ClientServiceException
- if an S3 error occurredjava.io.IOException
- if an S3 error occurred
-
getObject
public java.io.InputStream getObject(java.lang.String bucket, java.lang.String object, long offset) throws S3ClientServiceException, java.io.IOExceptionDescription copied from interface:S3ClientService
Read an object- Specified by:
getObject
in interfaceS3ClientService
- Parameters:
bucket
- Bucket nameobject
- Object pathoffset
- Start reading at this offset- Returns:
- InputStream to the object
- Throws:
S3ClientServiceException
- if an S3 error occurredjava.io.IOException
- if an S3 error occurred
-
getObject
public void getObject(java.lang.String bucket, java.lang.String object, java.lang.String filename) throws S3ClientServiceException, java.io.IOExceptionDescription copied from interface:S3ClientService
Download an object- Specified by:
getObject
in interfaceS3ClientService
- Parameters:
bucket
- Bucket nameobject
- Object pathfilename
- Destination file- Throws:
S3ClientServiceException
- if an S3 error occurredjava.io.IOException
- if an S3 error occurred
-