public interface Bytes
| Modifier and Type | Method and Description |
|---|---|
default void |
asChunks(ByteArrayConsumer consumer)
Stream this instance to the given consumer.
|
default void |
asChunks(int size,
ByteArrayConsumer consumer)
Stream this instance to the given consumer with a specific chunk size.
|
default ExtendedDataInput |
asDataInput()
Open this instance as a
ExtendedDataInput. |
InputStream |
asInputStream()
Open an
InputStream for this instance. |
static BytesBuilder |
create() |
static Bytes |
create(byte[] byteArray)
Create an instance for the given array of bytes.
|
static Bytes |
create(IoSupplier<InputStream> stream)
Create an instance over the given input stream.
|
static Bytes |
empty()
Get an instance that represents no data.
|
static Bytes |
lazyViaDataOutput(IoConsumer<ExtendedDataOutput> creator)
Create an instance that will create data on demand.
|
static Bytes |
lazyViaDataOutput(IoConsumer<ExtendedDataOutput> creator,
int expectedSize)
Create an instance that will create data on demand.
|
byte[] |
toByteArray()
Convert this instance to a byte array.
|
static Bytes |
viaDataOutput(IoConsumer<ExtendedDataOutput> creator)
Create an instance by running the given function and storing the result in memory.
|
static Bytes |
viaDataOutput(IoConsumer<ExtendedDataOutput> creator,
int expectedSize)
Create an instance by running the given function and storing the result in memory.
|
InputStream asInputStream() throws IOException
InputStream for this instance.IOExceptionbyte[] toByteArray()
throws IOException
IOExceptiondefault void asChunks(ByteArrayConsumer consumer) throws IOException
consumer - IOExceptiondefault void asChunks(int size,
ByteArrayConsumer consumer)
throws IOException
size - consumer - IOExceptiondefault ExtendedDataInput asDataInput() throws IOException
ExtendedDataInput.IOExceptionstatic Bytes empty()
static Bytes create(byte[] byteArray)
byteArray - static Bytes create(IoSupplier<InputStream> stream)
stream - static Bytes lazyViaDataOutput(IoConsumer<ExtendedDataOutput> creator)
creator - static Bytes lazyViaDataOutput(IoConsumer<ExtendedDataOutput> creator, int expectedSize)
creator - expectedSize - static Bytes viaDataOutput(IoConsumer<ExtendedDataOutput> creator) throws IOException
creator - IOExceptionstatic Bytes viaDataOutput(IoConsumer<ExtendedDataOutput> creator, int expectedSize) throws IOException
creator - expectedSize - IOExceptionstatic BytesBuilder create()
Copyright © 2016. All rights reserved.