java.lang.Object
io.helidon.media.common.ContentWriters
Utility class that provides standalone mechanisms for writing message body
content.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Function<byte[],
Flow.Publisher<DataChunk>> byteArrayWriter
(boolean copy) Deprecated.Deprecated.since 2.0.0, useDefaultMediaSupport.byteChannelWriter()
} insteadbyteChannelWriter
(RetrySchema retrySchema) Deprecated.since 2.0.0, useDefaultMediaSupport.byteChannelWriter(RetrySchema)
} insteadstatic Function<CharBuffer,
Flow.Publisher<DataChunk>> charBufferWriter
(Charset charset) Deprecated.since 2.0.0, usewriteCharBuffer(CharBuffer, Charset)
insteadstatic Function<CharSequence,
Flow.Publisher<DataChunk>> charSequenceWriter
(Charset charset) Deprecated.since 2.0.0, usewriteCharSequence(CharSequence, Charset)
orDefaultMediaSupport.charSequenceWriter()
insteadwriteBytes
(byte[] bytes, boolean copy) writeCharBuffer
(CharBuffer buffer, Charset charset) writeCharSequence
(CharSequence cs, Charset charset) writeStackTrace
(Throwable throwable, Charset charset)
-
Method Details
-
writeBytes
- Parameters:
bytes
- the byte arraycopy
- iftrue
the byte array is copied- Returns:
- Single
- Since:
- 2.0.0
-
writeCharSequence
- Parameters:
cs
- the char sequencecharset
- the charset to use to encode the char sequence- Returns:
- Single
- Since:
- 2.0.0
-
writeCharBuffer
- Parameters:
buffer
- the char buffercharset
- the charset to use to encode the char sequence- Returns:
- Single
- Since:
- 2.0.0
-
writeStackTrace
- Parameters:
throwable
- theThrowable
charset
- the charset to use to encode the stack trace- Returns:
- Single
- Since:
- 2.0.0
-
byteArrayWriter
@Deprecated(since="2.0.0") public static Function<byte[],Flow.Publisher<DataChunk>> byteArrayWriter(boolean copy) Deprecated.since 2.0.0, usewriteBytes(byte[], boolean)
insteadReturns a writer function forbyte[]
.The
copy
variant is by default registered inServerResponse
.- Parameters:
copy
- a signal if byte array should be copied - set ittrue
ifbyte[]
will be immediately reused.- Returns:
- a
byte[]
writer
-
charSequenceWriter
@Deprecated(since="2.0.0") public static Function<CharSequence,Flow.Publisher<DataChunk>> charSequenceWriter(Charset charset) Deprecated.since 2.0.0, usewriteCharSequence(CharSequence, Charset)
orDefaultMediaSupport.charSequenceWriter()
insteadReturns a writer function forCharSequence
using provided standardcharset
.An instance is by default registered in
ServerResponse
for all standard charsets.- Parameters:
charset
- a standard charset to use- Returns:
- a
String
writer - Throws:
NullPointerException
- if parametercharset
isnull
-
charBufferWriter
@Deprecated(since="2.0.0") public static Function<CharBuffer,Flow.Publisher<DataChunk>> charBufferWriter(Charset charset) Deprecated.since 2.0.0, usewriteCharBuffer(CharBuffer, Charset)
insteadReturns a writer function forCharBuffer
using provided standardcharset
.An instance is by default registered in
ServerResponse
for all standard charsets.- Parameters:
charset
- a standard charset to use- Returns:
- a
String
writer - Throws:
NullPointerException
- if parametercharset
isnull
-
byteChannelWriter
@Deprecated(since="2.0.0") public static Function<ReadableByteChannel,Flow.Publisher<DataChunk>> byteChannelWriter(RetrySchema retrySchema) Deprecated.since 2.0.0, useDefaultMediaSupport.byteChannelWriter(RetrySchema)
} insteadReturns a writer function forReadableByteChannel
. Created publisher use providedRetrySchema
to define delay between unsuccessful read attempts.- Parameters:
retrySchema
- a retry schema to use in case whenread
operation reads0 bytes
- Returns:
- a
ReadableByteChannel
writer
-
byteChannelWriter
@Deprecated(since="2.0.0") public static Function<ReadableByteChannel,Flow.Publisher<DataChunk>> byteChannelWriter()Deprecated.since 2.0.0, useDefaultMediaSupport.byteChannelWriter()
} insteadReturns a writer function forReadableByteChannel
.- Returns:
- a
ReadableByteChannel
writer
-
writeBytes(byte[], boolean)
instead