public class AWSArtifactReader extends Object implements ArtifactReadable
| Constructor and Description |
|---|
AWSArtifactReader(String region,
String bucket)
Creates an instance of
AWSArtifactReader for the given region and bucket name. |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getArtifactStream(String key)
Read the artifacts for the given key and return an input stream without truncating.
|
Boolean |
isArtifactExist(String key)
Verify the existence of the artifact for the given key.
|
TruncatedInputStreamData |
readArtifact(String key)
Read the artifacts for the given key and return an input stream.
|
TruncatedInputStreamData |
readArtifact(String key,
int kiloByteLimit)
Read the artifacts for the given key and return an input stream.
|
public AWSArtifactReader(String region, String bucket) throws ArtifactReaderException, IOException
AWSArtifactReader for the given region and bucket name.
Please do note that accessKey and secretKey values should be set in a properties file in order to authenticate to the AWS.
region - region where the S3 bucket is locatedbucket - name of the bucketArtifactReaderException - thrown if the given parameters are null or emptyIOExceptionpublic TruncatedInputStreamData readArtifact(String key) throws ArtifactReaderException
ArtifactReadablereadArtifact in interface ArtifactReadablekey - key of the artifact to downloadTruncatedInputStreamData containing input stream of the artifact and whether the input stream is
truncated or notArtifactReaderException - thrown when error on downloading artifactspublic TruncatedInputStreamData readArtifact(String key, int kiloByteLimit) throws ArtifactReaderException
ArtifactReadablereadArtifact in interface ArtifactReadablekey - key of the artifact to downloadkiloByteLimit - maximum number of kilo bytes to readTruncatedInputStreamData containing input stream of the artifact and whether the input stream is
truncated or notArtifactReaderException - thrown when error on downloading artifactspublic InputStream getArtifactStream(String key)
ArtifactReadablegetArtifactStream in interface ArtifactReadablekey - key of the artifact to downloadInputStream containing input stream of the artifactpublic Boolean isArtifactExist(String key)
ArtifactReadableisArtifactExist in interface ArtifactReadablekey - key of the artifact to downloadBoolean If artifact exist in the remote storage return True otherwise return FalseCopyright © 2019 WSO2. All rights reserved.