SdkBytes (AWS SDK for Java

SdkBytes (AWS SDK for Java - 2.25.21)
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

    Create SdkBytes from a Byte array without copying the contents of the byte array. Create SdkBytes from a string, using the provided charset. Create SdkBytes from a string, using the UTF-8 charset.
  • Method Details

    • fromByteBuffer

      Create SdkBytes from a Byte buffer. This will read the remaining contents of the byte buffer.
    • fromByteArray

      public static SdkBytes fromByteArray(byte[] bytes)Create SdkBytes from a Byte array. This will copy the contents of the byte array.
    • fromByteArrayUnsafe

      public static SdkBytes fromByteArrayUnsafe(byte[] bytes)Create SdkBytes 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 this SdkBytes implementation AND (2) any users of BytesWrapper.asByteArrayUnsafe() to modify the byte array passed into this SdkBytes implementation.

      As the method name implies, this is unsafe. Use fromByteArray(byte[]) unless you're sure you know the risks.

    • fromString

      Create SdkBytes from a string, using the provided charset.
    • fromUtf8String

      Create SdkBytes from a string, using the UTF-8 charset.
    • fromInputStream

      Create SdkBytes from an input stream. This will read all of the remaining contents of the stream, but will not close it.
    • toString

      Overrides:
      toString in class Object

You Might Also Like