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>
ACharsetDecoderFlowableTransformerdecodes bytes from a stream ofByteBufferinto a stream ofCharBufferusing 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 ofByteBufferinto a flow ofCharBufferusing the givenCharBufferandCharsetDecodersuppliers.
-
-
-
Method Detail
-
decode
public static io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer> decode(Charset charset)
Decodes a flow ofByteBufferinto a flow ofCharBufferusing the givenCharset.This transformer uses a
CharsetDecoderconfigured 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
ByteBuffertoCharBuffer
-
decode
public static io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer> decode(Supplier<CharsetDecoder> decoderSupplier)
Decodes a flow ofByteBufferinto a flow ofCharBufferusing the givenCharsetDecodersupplier.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
ByteBuffertoCharBuffer
-
decode
public static io.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer> decode(Supplier<CharsetDecoder> decoderSupplier, int workingByteBufferCapacity, Supplier<CharBuffer> outputBufferSupplier)
Decodes a flow ofByteBufferinto a flow ofCharBufferusing the givenCharBufferandCharsetDecodersuppliers.- 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
ByteBuffertoCharBuffer
-
apply
@NonNull public @NonNull org.reactivestreams.Publisher<CharBuffer> apply(@NonNull @NonNull io.reactivex.rxjava3.core.Flowable<ByteBuffer> upstream)
- Specified by:
applyin interfaceio.reactivex.rxjava3.core.FlowableTransformer<ByteBuffer,CharBuffer>
-
-