- java.lang.Object
-
- io.helidon.media.common.ContentReaders
-
public final class ContentReaders extends Object
Utility class that provides standalone mechanisms for reading message body content.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Reader<byte[]>
byteArrayReader()
Deprecated.since 2.0.0, usereadBytes(Publisher)
insteadstatic Reader<InputStream>
inputStreamReader()
Deprecated.since 2.0.0, useDefaultMediaSupport.inputStreamReader()
static Single<byte[]>
readBytes(Flow.Publisher<DataChunk> chunks)
Collect theDataChunk
of the given publisher into a single byte array.static Single<String>
readString(Flow.Publisher<DataChunk> chunks, Charset charset)
static Single<String>
readURLEncodedString(Flow.Publisher<DataChunk> chunks, Charset charset)
static Reader<String>
stringReader(Charset charset)
Deprecated.since 2.0.0, usereadString(Publisher, Charset)
} orDefaultMediaSupport.stringReader()
insteadstatic Reader<String>
urlEncodedStringReader(Charset charset)
Deprecated.since 2.0.0, usereadURLEncodedString(Publisher, Charset)
instead
-
-
-
Method Detail
-
readBytes
public static Single<byte[]> readBytes(Flow.Publisher<DataChunk> chunks)
Collect theDataChunk
of the given publisher into a single byte array.- Parameters:
chunks
- source publisher- Returns:
- Single
- Since:
- 2.0.0
-
readString
public static Single<String> readString(Flow.Publisher<DataChunk> chunks, Charset charset)
- Parameters:
chunks
- source publishercharset
- charset to use for decoding the bytes- Returns:
- Single
-
readURLEncodedString
public static Single<String> readURLEncodedString(Flow.Publisher<DataChunk> chunks, Charset charset)
- Parameters:
chunks
- source publishercharset
- charset to use for decoding the input- Returns:
- Single
- Since:
- 2.0.0
-
stringReader
@Deprecated(since="2.0.0") public static Reader<String> stringReader(Charset charset)
Deprecated.since 2.0.0, usereadString(Publisher, Charset)
} orDefaultMediaSupport.stringReader()
instead- Parameters:
charset
- the charset to use with the returned string content reader- Returns:
- a string content reader
-
urlEncodedStringReader
@Deprecated(since="2.0.0") public static Reader<String> urlEncodedStringReader(Charset charset)
Deprecated.since 2.0.0, usereadURLEncodedString(Publisher, Charset)
instead- Parameters:
charset
- the charset to use with the returned string content reader- Returns:
- the URL-decoded string content reader
-
byteArrayReader
@Deprecated(since="2.0.0") public static Reader<byte[]> byteArrayReader()
Deprecated.since 2.0.0, usereadBytes(Publisher)
insteadGet a reader that converts aDataChunk
publisher to an array of bytes.- Returns:
- reader that transforms a publisher of byte buffers to a completion stage that might end exceptionally with
-
inputStreamReader
@Deprecated(since="2.0.0") public static Reader<InputStream> inputStreamReader()
Deprecated.since 2.0.0, useDefaultMediaSupport.inputStreamReader()
Get a reader that converts aDataChunk
publisher to a blocking JavaInputStream
. The resultingCompletionStage
is already completed; however, the referencedInputStream
in it may not already have all the data available; in such case, the read method (e.g.,InputStream.read()
) block.- Returns:
- a input stream content reader
-
-