Interface BinaryResponse
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
BinaryDataResponse
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 Details
-
contentType
String contentType()The response content type. If not known, defaults toapplication/octet-stream
. -
contentLength
long contentLength()The content length, or-1
if not known. -
content
The response body. This method can be called only once and will throw anIllegalStateException
on subsequent calls.Calling
InputStream.close()
on the result has the same effect as callingclose()
on this object.- Throws:
IOException
- if the stream could not be createdIllegalStateException
- if this method has already been called
-
close
Releases any resources associated with this response.- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
-