Package dev.gmitch215.bytebox.net.http
Class HttpResponse.BodyHandlers
java.lang.Object
dev.gmitch215.bytebox.net.http.HttpResponse.BodyHandlers
- Enclosing class:
HttpResponse<T>
The ways to read a body.
-
Method Summary
Modifier and TypeMethodDescriptionstatic HttpResponse.BodyHandler<Void> Returns a handler that reads the body and throws it away.static HttpResponse.BodyHandler<byte[]> Returns a handler reading the body as bytes.static HttpResponse.BodyHandler<InputStream> Returns a handler reading the body as a stream over bytes already in hand.static HttpResponse.BodyHandler<String> ofString()Returns a handler reading the body as UTF-8 text.static HttpResponse.BodyHandler<String> Reads the body as text.
-
Method Details
-
ofString
Returns a handler reading the body as UTF-8 text.- Returns:
- a handler reading the body as UTF-8 text
-
ofString
Reads the body as text.- Parameters:
charset- how to decode it- Returns:
- the handler
-
ofByteArray
Returns a handler reading the body as bytes.- Returns:
- a handler reading the body as bytes
-
ofInputStream
Returns a handler reading the body as a stream over bytes already in hand.- Returns:
- a handler reading the body as a stream over bytes already in hand
-
discarding
Returns a handler that reads the body and throws it away.- Returns:
- a handler that reads the body and throws it away
-