Package dev.getelements.elements.rt
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 TypeMethodDescription<T> TReads the object to another type.default <T> TReads a payload from the supplied byte array.<T> Tread(Class<T> payloadType, InputStream stream) Reads the actual response object to theInputStream.
-
Method Details
-
convert
Reads the object to another type.- Type Parameters:
T- the type- Parameters:
to- the type to readfrom- the type from which to read- Returns:
- an instance of the requested type, read from the supplied object.
-
read
Reads the actual response object to theInputStream.- Parameters:
payloadType- the the response objectstream- the output stream- Throws:
IOException
-
read
Reads a payload from the supplied byte array. The default implementation of this method uses a temporaryByteArrayInputStreamto accomplish the deserialization.- Type Parameters:
T- the type of the payload- Parameters:
payloadType- the type of the payloadtoRead- the byte array to read- Returns:
- the deserialized payload
- Throws:
IOException
-