- java.lang.Object
-
- io.helidon.media.common.ContentWriters
-
public final class ContentWriters extends Object
Utility class that provides standalone mechanisms for writing message body content.
-
-
Method Summary
-
-
-
Method Detail
-
writeBytes
public static Single<DataChunk> writeBytes(byte[] bytes, boolean copy)
- Parameters:
bytes
- the byte arraycopy
- iftrue
the byte array is copied- Returns:
- Single
- Since:
- 2.0.0
-
writeCharSequence
public static Single<DataChunk> writeCharSequence(CharSequence cs, Charset charset)
- Parameters:
cs
- the char sequencecharset
- the charset to use to encode the char sequence- Returns:
- Single
- Since:
- 2.0.0
-
writeCharBuffer
public static Single<DataChunk> writeCharBuffer(CharBuffer buffer, Charset charset)
- Parameters:
buffer
- the char buffercharset
- the charset to use to encode the char sequence- Returns:
- Single
- Since:
- 2.0.0
-
writeStackTrace
public static Single<DataChunk> writeStackTrace(Throwable throwable, Charset charset)
- 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
-
-