public final class AsyncStreamHelper extends Object
AsyncInputStream
or AsyncOutputStream
instances.
Provides support for:
byte[]
- Converts byte arrays into Async StreamsByteBuffer
- Converts ByteBuffers into Async StreamsInputStream
- Converts InputStreams into Async Streams (Note: InputStream implementations are blocking)OutputStream
- Converts OutputStreams into Async Streams (Note: OutputStream implementations are blocking)public static AsyncInputStream toAsyncInputStream(byte[] srcBytes)
byte[]
into a AsyncInputStream
srcBytes
- the data sourcepublic static AsyncInputStream toAsyncInputStream(byte[] srcBytes, ObservableAdapter observableAdapter)
byte[]
into a AsyncInputStream
srcBytes
- the data sourceobservableAdapter
- the ObservableAdapterpublic static AsyncOutputStream toAsyncOutputStream(byte[] dstBytes)
byte[]
into a AsyncOutputStream
dstBytes
- the data destinationpublic static AsyncOutputStream toAsyncOutputStream(byte[] dstBytes, ObservableAdapter observableAdapter)
byte[]
into a AsyncOutputStream
dstBytes
- the data destinationobservableAdapter
- the ObservableAdapterpublic static AsyncInputStream toAsyncInputStream(ByteBuffer srcByteBuffer)
ByteBuffer
into a AsyncInputStream
srcByteBuffer
- the data sourcepublic static AsyncInputStream toAsyncInputStream(ByteBuffer srcByteBuffer, ObservableAdapter observableAdapter)
ByteBuffer
into a AsyncInputStream
srcByteBuffer
- the data sourceobservableAdapter
- the ObservableAdapterpublic static AsyncOutputStream toAsyncOutputStream(ByteBuffer dstByteBuffer)
ByteBuffer
into a AsyncOutputStream
dstByteBuffer
- the data destinationpublic static AsyncOutputStream toAsyncOutputStream(ByteBuffer dstByteBuffer, ObservableAdapter observableAdapter)
ByteBuffer
into a AsyncOutputStream
dstByteBuffer
- the data destinationobservableAdapter
- the ObservableAdapterpublic static AsyncInputStream toAsyncInputStream(InputStream inputStream)
InputStream
into a AsyncInputStream
inputStream
- the InputStreampublic static AsyncInputStream toAsyncInputStream(InputStream inputStream, ObservableAdapter observableAdapter)
InputStream
into a AsyncInputStream
inputStream
- the InputStreamobservableAdapter
- the ObservableAdapterpublic static AsyncOutputStream toAsyncOutputStream(OutputStream outputStream)
OutputStream
into a AsyncOutputStream
outputStream
- the OutputStreampublic static AsyncOutputStream toAsyncOutputStream(OutputStream outputStream, ObservableAdapter observableAdapter)
OutputStream
into a AsyncOutputStream
outputStream
- the OutputStreamobservableAdapter
- the ObservableAdapter