Package be.wegenenverkeer.rxhttpclient
Interface ServerResponseBodyPart
-
- All Superinterfaces:
ServerResponseElement
- All Known Implementing Classes:
ServerResponse,ServerResponseBodyPartImpl
public interface ServerResponseBodyPart extends ServerResponseElement
a part of the response body, either a chunk in a chunked-encoded response, or the whole response body. Created by Karel Maesen, Geovise BVBA on 18/12/14.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description byte[]getBodyPartBytes()Returns the bytes of the response body.default booleanisEmpty()booleanisLast()default <T> Tmatch(java.util.function.Function<ServerResponseStatus,T> matchStatus, java.util.function.Function<ServerResponseHeaders,T> matchHeaders, java.util.function.Function<ServerResponseBodyPart,T> matchBodyPart, java.util.function.Function<ServerResponse,T> matchServerResponse)Apply a function on this instance, depending on its type.
-
-
-
Method Detail
-
getBodyPartBytes
byte[] getBodyPartBytes()
Returns the bytes of the response body.- Returns:
- the bytes of the response body.
-
isLast
boolean isLast()
-
isEmpty
default boolean isEmpty()
-
match
default <T> T match(java.util.function.Function<ServerResponseStatus,T> matchStatus, java.util.function.Function<ServerResponseHeaders,T> matchHeaders, java.util.function.Function<ServerResponseBodyPart,T> matchBodyPart, java.util.function.Function<ServerResponse,T> matchServerResponse)
Apply a function on this instance, depending on its type.This uses a condensed form of the Visitor pattern.
- Specified by:
matchin interfaceServerResponseElement- Type Parameters:
T- the return type of all matcher functions- Parameters:
matchStatus- the function to invoke when this instance is aServerResponseStatusmatchHeaders- the function to invoke when this instance is aServerResponseHeadersmatchBodyPart- the function to invoke when this instance is aServerResponseBodyPartmatchServerResponse- the function to invoke when this instance is aServerResponse- Returns:
- the result of the matcher function that matches this instance type
-
-