Interface PayloadReader

All Known Implementing Classes:
FSTPayloadReader, KryoPayloadReader, ObjectMapperPayloadReader

public interface PayloadReader
Handles the actual details of writing to the OutputStream.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    convert(Class<T> to, Object from)
    Reads the object to another type.
    default <T> T
    read(Class<T> payloadType, byte[] toRead)
    Reads a payload from the supplied byte array.
    <T> T
    read(Class<T> payloadType, InputStream stream)
    Reads the actual response object to the InputStream.
  • Method Details

    • convert

      <T> T convert(Class<T> to, Object from)
      Reads the object to another type.
      Type Parameters:
      T - the type
      Parameters:
      to - the type to read
      from - the type from which to read
      Returns:
      an instance of the requested type, read from the supplied object.
    • read

      <T> T read(Class<T> payloadType, InputStream stream) throws IOException
      Reads the actual response object to the InputStream.
      Parameters:
      payloadType - the the response object
      stream - the output stream
      Throws:
      IOException
    • read

      default <T> T read(Class<T> payloadType, byte[] toRead) throws IOException
      Reads a payload from the supplied byte array. The default implementation of this method uses a temporary ByteArrayInputStream to accomplish the deserialization.
      Type Parameters:
      T - the type of the payload
      Parameters:
      payloadType - the type of the payload
      toRead - the byte array to read
      Returns:
      the deserialized payload
      Throws:
      IOException