Interface ServerResponseBodyPart

    • 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:
        match in interface ServerResponseElement
        Type Parameters:
        T - the return type of all matcher functions
        Parameters:
        matchStatus - the function to invoke when this instance is a ServerResponseStatus
        matchHeaders - the function to invoke when this instance is a ServerResponseHeaders
        matchBodyPart - the function to invoke when this instance is a ServerResponseBodyPart
        matchServerResponse - the function to invoke when this instance is a ServerResponse
        Returns:
        the result of the matcher function that matches this instance type