Interface EntityReader<T>
- Type Parameters:
T- type of object to read
- All Known Implementing Classes:
EntityReaderBase
public interface EntityReader<T>
Reader of entity into a specific type.
-
Method Summary
Modifier and TypeMethodDescriptionread(GenericType<T> type, InputStream stream, Headers headers) Read server request entity and close the stream when consumption is complete.read(GenericType<T> type, InputStream stream, Headers requestHeaders, Headers responseHeaders) Read client response entity and close the stream when consumption is complete.default Tread(GenericType<T> type, InputStream stream, Headers requestHeaders, Headers responseHeaders, EntityReaderContext context) Read a client response entity with its policy for nested entity conversions.default Tread(GenericType<T> type, InputStream stream, Headers headers, EntityReaderContext context) Read a server request entity with its policy for nested entity conversions.default booleanWhether this reader processes the entity incrementally without materializing it in memory.
-
Method Details
-
streaming
default boolean streaming()Whether this reader processes the entity incrementally without materializing it in memory. This includes copying the supplied stream to a file or another sink during the read call, as well as returning a lazy entity that consumes the stream after the read call returns. Streaming readers are not subject tomax-buffered-entity-size; independently configured payload limits still apply. The default isfalse, including for custom readers. A reader that consumes the stream during the read call must close it before returning. A reader that returns a lazy entity must transfer responsibility for closing the stream to that entity and keep the stream usable until consumption is complete.- Returns:
trueif the entity is processed without materializing it in memory
-
read
Read server request entity and close the stream when consumption is complete. A streaming reader may transfer stream ownership to a lazy entity as described bystreaming().- Parameters:
type- type of entitystream- stream to read fromheaders- request headers- Returns:
- correctly typed entity
-
read
Read client response entity and close the stream when consumption is complete. A streaming reader may transfer stream ownership to a lazy entity as described bystreaming().- Parameters:
type- type of entitystream- stream to read fromrequestHeaders- request headersresponseHeaders- response headers- Returns:
- correctly typed entity
-
read
default T read(GenericType<T> type, InputStream stream, Headers headers, EntityReaderContext context) Read a server request entity with its policy for nested entity conversions. Readers that return nested entities can retaincontextand use it for each nested conversion. The supplied stream already has the appropriate limits applied; the context is for nested streams. The default implementation delegates toread(GenericType, InputStream, Headers).- Parameters:
type- entity typestream- stream to readheaders- request headerscontext- reading policy inherited by nested entities- Returns:
- converted entity
-
read
default T read(GenericType<T> type, InputStream stream, Headers requestHeaders, Headers responseHeaders, EntityReaderContext context) Read a client response entity with its policy for nested entity conversions. Readers that return nested entities can retaincontextand use it for each nested conversion. The supplied stream already has the appropriate limits applied; the context is for nested streams. The default implementation delegates toread(GenericType, InputStream, Headers, Headers).- Parameters:
type- entity typestream- stream to readrequestHeaders- request headersresponseHeaders- response headerscontext- reading policy inherited by nested entities- Returns:
- converted entity
-