public final class ByteArrayByteSource extends Object implements ByteSource, Serializable
EMPTY_BYTES
Constructor and Description |
---|
ByteArrayByteSource(byte[] bytes)
Create a new ByteSource backed by a byte[].
|
Modifier and Type | Method and Description |
---|---|
byte[] |
asBytes() |
InputStream |
asStream() |
String |
asString(Charset charset) |
static ByteArrayByteSource |
of(String string) |
static ByteArrayByteSource |
of(String string, Charset charset) |
public ByteArrayByteSource(byte[] bytes)
bytes
- Array of bytes
public static ByteArrayByteSource of(String string)
public static ByteArrayByteSource of(String string, Charset charset)
public byte[] asBytes()
asBytes
in interface
ByteSource
public InputStream asStream()
asStream
in interface
ByteSource
public String asString(Charset charset)
asString
in interface
ByteSource
charset
- Charset