Package io.awspring.cloud.s3
Class S3Resource
java.lang.Object
org.springframework.core.io.AbstractResource
io.awspring.cloud.s3.S3Resource
- All Implemented Interfaces:
InputStreamSource
,Resource
,WritableResource
Resource
implementation for S3 objects.- Since:
- 3.0
- Author:
- Agim Emruli, Alain Sahli, Maciej Walkowiak, Yuki Yoshida
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Location
protected final software.amazon.awssdk.services.s3.S3Client
protected final S3OutputStreamProvider
-
Constructor Summary
ConstructorsConstructorDescriptionS3Resource
(Location location, software.amazon.awssdk.services.s3.S3Client s3Client, S3OutputStreamProvider s3OutputStreamProvider) S3Resource
(String bucket, String key, software.amazon.awssdk.services.s3.S3Client s3Client, S3OutputStreamProvider s3OutputStreamProvider) S3Resource
(String location, software.amazon.awssdk.services.s3.S3Client s3Client, S3OutputStreamProvider s3OutputStreamProvider) -
Method Summary
Modifier and TypeMethodDescriptionlong
static S3Resource
create
(String location, software.amazon.awssdk.services.s3.S3Client s3Client, S3OutputStreamProvider s3OutputStreamProvider) createRelative
(String relativePath) boolean
exists()
getFile()
getURL()
long
metadata()
void
setObjectMetadata
(ObjectMetadata objectMetadata) Methods inherited from class org.springframework.core.io.AbstractResource
equals, getFileForLastModifiedCheck, getURI, hashCode, isFile, isOpen, isReadable, readableChannel, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.core.io.Resource
getContentAsByteArray, getContentAsString, getURI, isFile, isOpen, isReadable, readableChannel
Methods inherited from interface org.springframework.core.io.WritableResource
isWritable, writableChannel
-
Field Details
-
location
-
s3Client
protected final software.amazon.awssdk.services.s3.S3Client s3Client -
s3OutputStreamProvider
-
-
Constructor Details
-
S3Resource
public S3Resource(String location, software.amazon.awssdk.services.s3.S3Client s3Client, S3OutputStreamProvider s3OutputStreamProvider) -
S3Resource
public S3Resource(String bucket, String key, software.amazon.awssdk.services.s3.S3Client s3Client, S3OutputStreamProvider s3OutputStreamProvider) -
S3Resource
public S3Resource(Location location, software.amazon.awssdk.services.s3.S3Client s3Client, S3OutputStreamProvider s3OutputStreamProvider)
-
-
Method Details
-
create
@Nullable public static S3Resource create(String location, software.amazon.awssdk.services.s3.S3Client s3Client, S3OutputStreamProvider s3OutputStreamProvider) -
getURL
- Specified by:
getURL
in interfaceResource
- Overrides:
getURL
in classAbstractResource
- Throws:
IOException
-
getDescription
- Specified by:
getDescription
in interfaceResource
-
createRelative
- Specified by:
createRelative
in interfaceResource
- Overrides:
createRelative
in classAbstractResource
-
getInputStream
- Specified by:
getInputStream
in interfaceInputStreamSource
- Throws:
IOException
-
contentType
-
setObjectMetadata
-
exists
public boolean exists()- Specified by:
exists
in interfaceResource
- Overrides:
exists
in classAbstractResource
-
contentLength
- Specified by:
contentLength
in interfaceResource
- Overrides:
contentLength
in classAbstractResource
- Throws:
IOException
-
lastModified
- Specified by:
lastModified
in interfaceResource
- Overrides:
lastModified
in classAbstractResource
- Throws:
IOException
-
getFile
- Specified by:
getFile
in interfaceResource
- Overrides:
getFile
in classAbstractResource
- Throws:
IOException
-
metadata
-
getOutputStream
- Specified by:
getOutputStream
in interfaceWritableResource
- Throws:
IOException
-
getFilename
- Specified by:
getFilename
in interfaceResource
- Overrides:
getFilename
in classAbstractResource
-
getLocation
-