Interface Body
- All Superinterfaces:
AutoCloseable
Generic HTTP request / response body. It is responsibility of the caller to close the body instance
explicitly (or through
GenericResponse instance) to release all associated resources.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbody()Gets the body asInputStreamdefault byte[]Gets the body asinvalid reference
byte[]default StringGets the body asStringvoidclose()Releases all resources associated with this body stream.Content type of this bodystatic BodyConstructs the generic response body out ofInputStreamwith assumed content typestatic Bodyfrom(InputStream body, String contentType) Constructs the generic response body out ofInputStreamwith assumed content type
-
Field Details
-
DEFAULT_BUFFER_SIZE
static final int DEFAULT_BUFFER_SIZE- See Also:
-
-
Method Details
-
from
Constructs the generic response body out ofInputStreamwith assumed content type- Parameters:
body- response body streamcontentType- content type- Returns:
- generic response body instance
-
from
Constructs the generic response body out ofInputStreamwith assumed content type- Parameters:
body- response body streamcontentType- content type- Returns:
- generic response body instance
-
contentType
String contentType()Content type of this body- Returns:
- content type
-
body
InputStream body()Gets the body asInputStream- Returns:
- body as
InputStream
-
bodyAsString
Gets the body asString- Returns:
- body as
String
-
bodyAsBytes
default byte[] bodyAsBytes()Gets the body asinvalid reference
byte[]- Returns:
- body as
invalid reference
byte[]
-
close
Releases all resources associated with this body stream.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-