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 SdkBytesfromByteArray(byte[] bytes) CreateSdkBytesfrom a Byte array.static SdkBytesfromByteArrayUnsafe(byte[] bytes) CreateSdkBytesfrom a Byte array without copying the contents of the byte array.static SdkBytesfromByteBuffer(ByteBuffer byteBuffer) CreateSdkBytesfrom a Byte buffer.static SdkBytesfromInputStream(InputStream inputStream) CreateSdkBytesfrom an input stream.static SdkBytesfromString(String string, Charset charset) CreateSdkBytesfrom a string, using the provided charset.static SdkBytesfromUtf8String(String string) CreateSdkBytesfrom 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
CreateSdkBytesfrom a Byte buffer. This will read the remaining contents of the byte buffer. -
fromByteArray
-
fromByteArrayUnsafe
CreateSdkBytesfrom 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 thisSdkBytesimplementation AND (2) any users ofBytesWrapper.asByteArrayUnsafe()to modify the byte array passed into thisSdkBytesimplementation.As the method name implies, this is unsafe. Use
fromByteArray(byte[])unless you're sure you know the risks. -
fromString
-
fromUtf8String
-
fromInputStream
CreateSdkBytesfrom an input stream. This will read all of the remaining contents of the stream, but will not close it. -
toString
-