Class ResponseBytes<ResponseT>
java.lang.Object
software.amazon.awssdk.core.BytesWrapper
software.amazon.awssdk.core.ResponseBytes<ResponseT>
An in-memory representation of the service's response from a streaming operation. This usually obtained by calling the "bytes"
form of a streaming operation, like S3's
getObjectBytes. Can also be retrieved by passing
ResponseTransformer.toBytes() or AsyncResponseTransformer.toBytes() to a streaming output operation.-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <ResponseT>
ResponseBytes<ResponseT> fromByteArray(ResponseT response, byte[] bytes) CreateResponseBytesfrom a Byte array.static <ResponseT>
ResponseBytes<ResponseT> fromByteArrayUnsafe(ResponseT response, byte[] bytes) CreateResponseBytesfrom a Byte array without copying the contents of the byte array.static <ResponseT>
ResponseBytes<ResponseT> fromInputStream(ResponseT response, InputStream stream) CreateResponseBytesfrom a Byte array.inthashCode()response()toString()Methods inherited from class software.amazon.awssdk.core.BytesWrapper
asByteArray, asByteArrayUnsafe, asByteBuffer, asContentStreamProvider, asInputStream, asString, asUtf8String
-
Method Details
-
fromInputStream
public static <ResponseT> ResponseBytes<ResponseT> fromInputStream(ResponseT response, InputStream stream) throws UncheckedIOException CreateResponseBytesfrom a Byte array. This will copy the contents of the byte array.- Throws:
UncheckedIOException
-
fromByteArray
CreateResponseBytesfrom a Byte array. This will copy the contents of the byte array. -
fromByteArrayUnsafe
public static <ResponseT> ResponseBytes<ResponseT> fromByteArrayUnsafe(ResponseT response, byte[] bytes) CreateResponseBytesfrom 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(Object, byte[])unless you're sure you know the risks. -
response
- Returns:
- the unmarshalled response object from the service.
-
toString
-
equals
- Overrides:
equalsin classBytesWrapper
-
hashCode
public int hashCode()- Overrides:
hashCodein classBytesWrapper
-