Package org.forgerock.http.io
Class CharsetDecoderFlowableTransformer
- java.lang.Object
-
- org.forgerock.http.io.CharsetDecoderFlowableTransformer
-
- All Implemented Interfaces:
io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer>
public final class CharsetDecoderFlowableTransformer extends Object implements io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer>
ACharsetDecoderFlowableTransformer
decodes bytes from a stream ofByteBuffer
into a stream ofCharBuffer
using the givenCharset
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NonNull org.reactivestreams.Publisher<CharBuffer>
apply(@NonNull io.reactivex.rxjava3.core.Flowable<ByteBuffer> upstream)
static io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer>
decode(Charset charset)
static io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer>
decode(Supplier<CharsetDecoder> decoderSupplier)
static io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer>
decode(Supplier<CharsetDecoder> decoderSupplier, int workingByteBufferCapacity, Supplier<CharBuffer> outputBufferSupplier)
Decodes a flow ofByteBuffer
into a flow ofCharBuffer
using the givenCharBuffer
andCharsetDecoder
suppliers.
-
-
-
Method Detail
-
decode
public static io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer> decode(Charset charset)
Decodes a flow ofByteBuffer
into a flow ofCharBuffer
using the givenCharset
.This transformer uses a
CharsetDecoder
configured to replace malformed and unmappable characters in order to behave as closely as possible to the JDKInputStreamReader
.The output char buffers will be new unpooled buffers.
- Parameters:
charset
- the target decoding charset- Returns:
- a flowable transformer of
ByteBuffer
toCharBuffer
-
decode
public static io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer> decode(Supplier<CharsetDecoder> decoderSupplier)
Decodes a flow ofByteBuffer
into a flow ofCharBuffer
using the givenCharsetDecoder
supplier.This transformer uses default's capacity for the working copy and decoded buffers (respectively 8192 and 8192). Decoded buffers are unpooled.
- Parameters:
decoderSupplier
- a supplier of the charset decoder to use- Returns:
- a flowable transformer of
ByteBuffer
toCharBuffer
-
decode
public static io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer> decode(Supplier<CharsetDecoder> decoderSupplier, int workingByteBufferCapacity, Supplier<CharBuffer> outputBufferSupplier)
Decodes a flow ofByteBuffer
into a flow ofCharBuffer
using the givenCharBuffer
andCharsetDecoder
suppliers.- Parameters:
decoderSupplier
- a supplier of the charset decoder to useworkingByteBufferCapacity
- Size of the working copyByteBuffer
(greater than 32)outputBufferSupplier
- a supplier of the decodedCharBuffer
- Returns:
- a flowable transformer of
ByteBuffer
toCharBuffer
-
apply
@NonNull public @NonNull org.reactivestreams.Publisher<CharBuffer> apply(@NonNull @NonNull io.reactivex.rxjava3.core.Flowable<ByteBuffer> upstream)
- Specified by:
apply
in interfaceio.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer>
-
-