public final class FlowableUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static io.reactivex.Single<byte[]> |
collectBytesInArray(io.reactivex.Flowable<ByteBuffer> content)
Collects byte buffers emitted by a Flowable into a byte array.
|
static io.reactivex.Single<ByteBuffer> |
collectBytesInBuffer(io.reactivex.Flowable<ByteBuffer> content)
Collects byte buffers emitted by a Flowable into a ByteBuffer.
|
static io.reactivex.FlowableTransformer<ByteBuffer,ByteBuffer> |
ensureLength(long bytesExpected)
Ensures the given Flowable emits the expected number of bytes.
|
static boolean |
isFlowableByteBuffer(Type entityType)
Checks if a type is Flowable<ByteBuffer>.
|
static io.reactivex.Flowable<ByteBuffer> |
readFile(AsynchronousFileChannel fileChannel)
Creates a
Flowable from an AsynchronousFileChannel
which reads the entire file. |
static io.reactivex.Flowable<ByteBuffer> |
readFile(AsynchronousFileChannel fileChannel,
int chunkSize,
long offset,
long length)
Creates a
Flowable from an AsynchronousFileChannel
which reads part of a file into chunks of the given size. |
static io.reactivex.Flowable<ByteBuffer> |
readFile(AsynchronousFileChannel fileChannel,
long offset,
long length)
Creates a
Flowable from an AsynchronousFileChannel
which reads part of a file. |
static io.reactivex.Flowable<ByteBuffer> |
split(ByteBuffer whole,
int chunkSize)
Splits a large ByteBuffer into chunks.
|
static io.reactivex.Completable |
writeFile(io.reactivex.Flowable<ByteBuffer> content,
AsynchronousFileChannel outFile)
Writes the bytes emitted by a Flowable to an AsynchronousFileChannel.
|
static io.reactivex.Completable |
writeFile(io.reactivex.Flowable<ByteBuffer> content,
AsynchronousFileChannel outFile,
long position)
Writes the bytes emitted by a Flowable to an AsynchronousFileChannel
starting at the given position in the file.
|
public static boolean isFlowableByteBuffer(Type entityType)
entityType - the type to checkpublic static io.reactivex.Single<byte[]> collectBytesInArray(io.reactivex.Flowable<ByteBuffer> content)
content - A stream which emits byte buffers.public static io.reactivex.FlowableTransformer<ByteBuffer,ByteBuffer> ensureLength(long bytesExpected)
bytesExpected - the number of bytes expected to be emittedFlowable.compose(io.reactivex.FlowableTransformer<? super T, ? extends R>)public static io.reactivex.Single<ByteBuffer> collectBytesInBuffer(io.reactivex.Flowable<ByteBuffer> content)
content - A stream which emits byte arrays.public static io.reactivex.Completable writeFile(io.reactivex.Flowable<ByteBuffer> content, AsynchronousFileChannel outFile)
content - the Flowable contentoutFile - the file channelpublic static io.reactivex.Completable writeFile(io.reactivex.Flowable<ByteBuffer> content, AsynchronousFileChannel outFile, long position)
content - the Flowable contentoutFile - the file channelposition - the position in the file to begin writingpublic static io.reactivex.Flowable<ByteBuffer> readFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length)
Flowable from an AsynchronousFileChannel
which reads part of a file into chunks of the given size.fileChannel - The file channel.chunkSize - the size of file chunks to read.offset - The offset in the file to begin reading.length - The number of bytes to read from the file.public static io.reactivex.Flowable<ByteBuffer> readFile(AsynchronousFileChannel fileChannel, long offset, long length)
Flowable from an AsynchronousFileChannel
which reads part of a file.fileChannel - The file channel.offset - The offset in the file to begin reading.length - The number of bytes to read from the file.public static io.reactivex.Flowable<ByteBuffer> readFile(AsynchronousFileChannel fileChannel)
Flowable from an AsynchronousFileChannel
which reads the entire file.fileChannel - The file channel.public static io.reactivex.Flowable<ByteBuffer> split(ByteBuffer whole, int chunkSize)
whole - the ByteBuffer to splitchunkSize - the maximum size of each emitted ByteBuffer/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/