Interface BinaryResponse

All Superinterfaces:
AutoCloseable

public interface BinaryResponse extends AutoCloseable
Response for API endpoints that return non-JSON content.

Note: binary responses hold a reference to the transport layer's response body. As such, they must be closed to ensure that any associated resources are released. Alternatively you can also close the content() stream.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Releases any resources associated with this response.
    The response body.
    long
    The content length, or -1 if not known.
    The response content type.
  • Method Details

    • contentType

      String contentType()
      The response content type. If not known, defaults to application/octet-stream.
    • contentLength

      long contentLength()
      The content length, or -1 if not known.
    • content

      InputStream content() throws IOException
      The response body. This method can be called only once and will throw an IllegalStateException on subsequent calls.

      Calling InputStream.close() on the result has the same effect as calling close() on this object.

      Throws:
      IOException - if the stream could not be created
      IllegalStateException - if this method has already been called
    • close

      void close() throws IOException
      Releases any resources associated with this response.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException