java.lang.Object
io.helidon.reactive.media.common.ContentWriters

public final class ContentWriters extends Object
Utility class that provides standalone mechanisms for writing message body content.
  • Method Details

    • writeBytes

      public static Single<DataChunk> writeBytes(byte[] bytes, boolean copy)
      Create a DataChunk with the given byte array and return a Single.
      Parameters:
      bytes - the byte array
      copy - if true the byte array is copied
      Returns:
      Single
      Since:
      2.0.0
    • writeCharSequence

      public static Single<DataChunk> writeCharSequence(CharSequence cs, Charset charset)
      Create a publisher of DataChunk with the given CharSequence / Charset and return a Single.
      Parameters:
      cs - the char sequence
      charset - 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)
      Create a a publisher DataChunk with the given CharBuffer / Charset and return a Single.
      Parameters:
      buffer - the char buffer
      charset - 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)
      Create a a publisher DataChunk with the given Throwable / Charset and return a Single.
      Parameters:
      throwable - the Throwable
      charset - the charset to use to encode the stack trace
      Returns:
      Single
      Since:
      2.0.0