Interface EntityWriter<T>

Type Parameters:
T - type of entity

public interface EntityWriter<T>
Writer of entity into bytes.
  • Method Details

    • supportsInstanceWriter

      default boolean supportsInstanceWriter()
      Whether this entity writer can provide more information about each entity instance, such as content length.
      Returns:
      whether instanceWriter methods are supported; If not one of the write methods would be called instead
    • instanceWriter

      default InstanceWriter instanceWriter(GenericType<T> type, T object, WritableHeaders<?> requestHeaders)
      Client request entity instance writer.
      Parameters:
      type - type of entity
      object - object to write
      requestHeaders - request headers
      Returns:
      instance writer ready to write the provided entity
    • instanceWriter

      default InstanceWriter instanceWriter(GenericType<T> type, T object, Headers requestHeaders, WritableHeaders<?> responseHeaders)
      Server response entity instance writer.
      Parameters:
      type - type of entity
      object - object to write
      requestHeaders - request headers
      responseHeaders - response headers
      Returns:
      instance writer ready to write the provided entity
    • write

      void write(GenericType<T> type, T object, OutputStream outputStream, Headers requestHeaders, WritableHeaders<?> responseHeaders)
      Write server response entity and close the stream.
      Parameters:
      type - type of entity
      object - object to write
      outputStream - output stream to write to
      requestHeaders - request headers
      responseHeaders - response headers
    • write

      void write(GenericType<T> type, T object, OutputStream outputStream, WritableHeaders<?> headers)
      Write client request entity and close the stream.
      Parameters:
      type - type of entity
      object - object to write
      outputStream - output stream to write to
      headers - request headers