- 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
CreateSdkBytesfrom a Byte array without copying the contents of the byte array. CreateSdkBytesfrom a string, using the provided charset. CreateSdkBytesfrom a string, using the UTF-8 charset.
Method Details
fromByteBuffer
CreateSdkBytesfrom a Byte buffer. This will read the remaining contents of the byte buffer.fromByteArray
public static SdkBytes fromByteArray(byte[] bytes)Create SdkBytesfrom a Byte array. This will copy the contents of the byte array.fromByteArrayUnsafe
public static SdkBytes fromByteArrayUnsafe(byte[] bytes)Create SdkBytesfrom 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
CreateSdkBytesfrom a string, using the provided charset.fromUtf8String
CreateSdkBytesfrom a string, using the UTF-8 charset.fromInputStream
CreateSdkBytesfrom an input stream. This will read all of the remaining contents of the stream, but will not close it.toString