Package software.amazon.awssdk.core
Class SdkBytes
java.lang.Object
software.amazon.awssdk.core.BytesWrapper
software.amazon.awssdk.core.SdkBytes
- All Implemented Interfaces:
Serializable
An in-memory representation of data being given to a service or being returned by a service.
This can be created via static methods, like
fromByteArray(byte[])
. This can be converted to binary types
via instance methods, like BytesWrapper.asByteArray()
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic SdkBytes
fromByteArray
(byte[] bytes) CreateSdkBytes
from a Byte array.static SdkBytes
fromByteArrayUnsafe
(byte[] bytes) CreateSdkBytes
from a Byte array without copying the contents of the byte array.static SdkBytes
fromByteBuffer
(ByteBuffer byteBuffer) CreateSdkBytes
from a Byte buffer.static SdkBytes
fromInputStream
(InputStream inputStream) CreateSdkBytes
from an input stream.static SdkBytes
fromString
(String string, Charset charset) CreateSdkBytes
from a string, using the provided charset.static SdkBytes
fromUtf8String
(String string) CreateSdkBytes
from a string, using the UTF-8 charset.toString()
Methods inherited from class software.amazon.awssdk.core.BytesWrapper
asByteArray, asByteArrayUnsafe, asByteBuffer, asContentStreamProvider, asInputStream, asString, asUtf8String, equals, hashCode
-
Method Details
-
fromByteBuffer
CreateSdkBytes
from a Byte buffer. This will read the remaining contents of the byte buffer. -
fromByteArray
CreateSdkBytes
from a Byte array. This will copy the contents of the byte array. -
fromByteArrayUnsafe
CreateSdkBytes
from a Byte array without copying the contents of the byte array. This introduces concurrency risks, allowing: (1) the caller to modify the byte array stored in thisSdkBytes
implementation AND (2) any users ofBytesWrapper.asByteArrayUnsafe()
to modify the byte array passed into thisSdkBytes
implementation.As the method name implies, this is unsafe. Use
fromByteArray(byte[])
unless you're sure you know the risks. -
fromString
CreateSdkBytes
from a string, using the provided charset. -
fromUtf8String
CreateSdkBytes
from a string, using the UTF-8 charset. -
fromInputStream
CreateSdkBytes
from an input stream. This will read all of the remaining contents of the stream, but will not close it. -
toString
-