public abstract class BytesWrapper extends Object
SdkBytes
and ResponseBytes
that enables retrieving an underlying byte array as multiple
different types, like a byte buffer (via asByteBuffer()
, or a string (via asUtf8String()
.Modifier and Type | Method and Description |
---|---|
byte[] |
asByteArray() |
ByteBuffer |
asByteBuffer() |
InputStream |
asInputStream() |
String |
asString(Charset charset)
Retrieve the output as a string.
|
String |
asUtf8String() |
boolean |
equals(Object o) |
int |
hashCode() |
public final ByteBuffer asByteBuffer()
public final byte[] asByteArray()
to prevent creating an additional array copy.
public final String asString(Charset charset) throws UncheckedIOException
charset
- The charset of the string.UncheckedIOException
- with a CharacterCodingException
as the cause if the bytes cannot be encoded using the
provided charsetpublic final String asUtf8String() throws UncheckedIOException
UncheckedIOException
- with a CharacterCodingException
as the cause if the bytes cannot be encoded as UTF-8.public final InputStream asInputStream()
Copyright © 2019. All rights reserved.