Class ContentReaders


  • public final class ContentReaders
    extends Object
    Utility class that provides standalone mechanisms for reading message body content.
    • Method Detail

      • readBytes

        public static Single<byte[]> readBytes​(Flow.Publisher<DataChunk> chunks)
        Collect the DataChunk of the given publisher into a single byte array.
        Parameters:
        chunks - source publisher
        Returns:
        Single
      • readURLEncodedString

        public static Single<String> readURLEncodedString​(Flow.Publisher<DataChunk> chunks,
                                                          Charset charset)
        Convert the publisher of DataChunk into a String processed through URL decoding.
        Parameters:
        chunks - source publisher
        charset - charset to use for decoding the input
        Returns:
        Single
      • stringReader

        public static Reader<String> stringReader​(Charset charset)
        Get a reader that converts a DataChunk publisher to a String.
        Parameters:
        charset - the charset to use with the returned string content reader
        Returns:
        a string content reader
      • urlEncodedStringReader

        public static Reader<String> urlEncodedStringReader​(Charset charset)
        Gets a reader that converts a DataChunk publisher to a String processed through URL decoding.
        Parameters:
        charset - the charset to use with the returned string content reader
        Returns:
        the URL-decoded string content reader
      • byteArrayReader

        public static Reader<byte[]> byteArrayReader()
        Get a reader that converts a DataChunk publisher to an array of bytes.
        Returns:
        reader that transforms a publisher of byte buffers to a completion stage that might end exceptionally with