Interface MessageBodyReader<T>

Type Parameters:
T - The generic type.
All Known Subinterfaces:
ChunkedMessageBodyReader<T>, MessageBodyHandler<T>, TypedMessageBodyHandler<T>, TypedMessageBodyReader<T>
All Known Implementing Classes:
JsonMessageHandler, NettyByteBufMessageBodyHandler, NettyJsonHandler, NettyJsonStreamHandler, StringBodyReader, TextPlainObjectBodyReader, WritableBodyWriter

@Indexed(MessageBodyReader.class) public interface MessageBodyReader<T>
An interface that allows reading a message body from the client or the server.

Implementors can defined beans that are annotated with Consumes to restrict the applicable content types.

Use Order to specify the precedence of the reader with lower order corresponding to higher precedence.

Since:
4.0.0
See Also:
  • Method Details

    • isReadable

      default boolean isReadable(Argument<T> type, @Nullable MediaType mediaType)
      Is the type readable.
      Parameters:
      type - The type
      mediaType - The media type, can be null
      Returns:
      True if is readable
    • read

      default @Nullable T read(Argument<T> type, @Nullable MediaType mediaType, Headers httpHeaders, ByteBuffer<?> byteBuffer) throws CodecException
      Reads an object from the given byte buffer.
      Parameters:
      type - The type being decoded.
      mediaType - The media type, can be null
      httpHeaders - The HTTP headers
      byteBuffer - The byte buffer
      Returns:
      The read object or null
      Throws:
      CodecException - If an error occurs decoding
    • read

      @Nullable T read(Argument<T> type, @Nullable MediaType mediaType, Headers httpHeaders, InputStream inputStream) throws CodecException
      Reads an object from the given byte buffer.
      Parameters:
      type - The type being decoded.
      mediaType - The media type, can be null
      httpHeaders - The HTTP headers
      inputStream - The input stream
      Returns:
      The read object or null
      Throws:
      CodecException - If an error occurs decoding