public class S3
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
S3()
Create new instance of S3.
|
S3(byte[] bytes)
Create new instance of S3 from provided byte array.
|
S3(java.io.InputStream stream)
Create new instance of S3 from provided stream.
|
S3(java.io.InputStream stream,
long length)
Create new instance of S3 from provided stream.
|
S3(S3Repository repository)
Create new instance of S3.
|
Modifier and Type | Method and Description |
---|---|
void |
delete()
Remote data from the remote S3 server.
|
java.lang.String |
getBucket()
Bucket under which data will be saved.
|
byte[] |
getBytes()
Get bytes saved on the remote server.
|
byte[] |
getContent()
Get bytes saved on the remote server.
|
java.lang.String |
getKey()
Key for bucket in which the data was saved.
|
long |
getLength()
Byte length of data.
|
java.util.Map<java.lang.String,java.lang.String> |
getMetadata()
For convenience, various metadata can be associated with the remote data.
|
java.lang.String |
getMimeType()
For convenience, remote data can be assigned a mime type.
|
java.lang.String |
getName()
For convenience, remote data can be assigned a name.
|
java.io.InputStream |
getStream()
Get stream saved on the remote server.
|
java.lang.String |
getURI() |
S3 |
setMimeType(java.lang.String value)
For convenience, remote data can be assigned a mime type.
|
S3 |
setName(java.lang.String value)
For convenience, remote data can be assigned a name.
|
java.lang.String |
upload(byte[] bytes)
Upload provided bytes to remote S3 server.
|
java.lang.String |
upload(java.io.ByteArrayInputStream stream)
Upload provided stream to remote S3 server.
|
java.lang.String |
upload(java.io.InputStream stream,
long length)
Upload provided stream to remote S3 server.
|
java.lang.String |
upload(java.lang.String bucket,
byte[] bytes)
Upload provided bytes to remote S3 server.
|
java.lang.String |
upload(java.lang.String bucket,
java.io.InputStream stream,
long length)
Upload provided stream to remote S3 server.
|
public S3()
public S3(S3Repository repository)
S3 repository
.
Upload must be called before persistence to the database.repository
- custom S3 repositorypublic S3(java.io.InputStream stream) throws java.io.IOException
stream
- Input stream which will be sent to the remote serverjava.io.IOException
public S3(java.io.InputStream stream, long length) throws java.io.IOException
stream
- Input stream which will be sent to the remote serverlength
- size of the streamjava.io.IOException
public S3(byte[] bytes) throws java.io.IOException
bytes
- Byte array which will be sent to the remote serverjava.io.IOException
public java.lang.String getBucket()
public java.lang.String getKey()
public java.lang.String getURI()
public long getLength()
public java.lang.String getName()
public S3 setName(java.lang.String value)
value
- name which will be associated with datapublic java.lang.String getMimeType()
public S3 setMimeType(java.lang.String value)
value
- mime type which will be associated with datapublic java.util.Map<java.lang.String,java.lang.String> getMetadata()
public byte[] getContent() throws java.io.IOException
java.io.IOException
- in case of communication failurepublic java.io.InputStream getStream() throws java.io.IOException
java.io.IOException
- in case of communication failurepublic byte[] getBytes() throws java.io.IOException
java.io.IOException
- in case of communication failurepublic java.lang.String upload(java.io.ByteArrayInputStream stream) throws java.io.IOException
stream
- upload provided streamjava.io.IOException
- in case of communication errorpublic java.lang.String upload(java.io.InputStream stream, long length) throws java.io.IOException
stream
- upload provided streamlength
- size of provided streamjava.io.IOException
- in case of communication errorpublic java.lang.String upload(java.lang.String bucket, java.io.InputStream stream, long length) throws java.io.IOException
bucket
- bucket under data will be savedstream
- upload provided streamlength
- size of provided streamjava.io.IOException
- in case of communication errorpublic java.lang.String upload(byte[] bytes) throws java.io.IOException
bytes
- upload provided bytesjava.io.IOException
- in case of communication errorpublic java.lang.String upload(java.lang.String bucket, byte[] bytes) throws java.io.IOException
bucket
- bucket under data will be savedbytes
- upload provided bytesjava.io.IOException
- in case of communication errorpublic void delete() throws java.io.IOException
java.io.IOException
- in case of communication error