Interface Receiver

  • All Known Implementing Classes:
    AsyncReceiverImpl, BlockingReceiverImpl

    public interface Receiver
    Interface that provides an easy way to read data from the request. It is lambda compatible.
    Author:
    Stuart Douglas
    • Method Detail

      • setMaxBufferSize

        void setMaxBufferSize​(int maxBufferSize)
        Sets the maximum amount of data that will be buffered in memory. If you call a receiveFull* method and the request size is larger than this amount then the error callback with be invoked with a RequestTooBigException.
        Parameters:
        maxBufferSize - The maximum amount of data to be buffered
      • receiveFullString

        void receiveFullString​(Receiver.FullStringCallback callback,
                               Receiver.ErrorCallback errorCallback)
        Reads the request and invokes the callback when the request body has been fully read. This string will be interpreted according to StandardCharsets.ISO_8859_1. If there is an error reading the request the error callback will be invoked.
        Parameters:
        callback - The callback to invoke with the request
        errorCallback - The callback that is invoked on error
      • receiveFullString

        void receiveFullString​(Receiver.FullStringCallback callback)
        Reads the request and invokes the callback when the request body has been fully read. This string will be interpreted according to StandardCharsets.ISO_8859_1. If there is an error the exchange will be ended.
        Parameters:
        callback - The callback to invoke with the request
      • receivePartialString

        void receivePartialString​(Receiver.PartialStringCallback callback,
                                  Receiver.ErrorCallback errorCallback)
        Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. This string will be interpreted according to StandardCharsets.ISO_8859_1. If there is an error reading the request the error callback will be invoked.
        Parameters:
        callback - The callback to invoke with the request
        errorCallback - The callback that is invoked on error
      • receivePartialString

        void receivePartialString​(Receiver.PartialStringCallback callback)
        Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. This string will be interpreted according to StandardCharsets.ISO_8859_1. If there is an error the exchange will be ended.
        Parameters:
        callback - The callback to invoke with the request
      • receiveFullString

        void receiveFullString​(Receiver.FullStringCallback callback,
                               Receiver.ErrorCallback errorCallback,
                               Charset charset)
        Reads the request and invokes the callback when the request body has been fully read. This string will be interpreted according to the specified charset. If there is an error reading the request the error callback will be invoked.
        Parameters:
        callback - The callback to invoke with the request
        errorCallback - The callback that is invoked on error
        charset - The charset that is used to interpret the string
      • receiveFullString

        void receiveFullString​(Receiver.FullStringCallback callback,
                               Charset charset)
        Reads the request and invokes the callback when the request body has been fully read. This string will be interpreted according to the specified charset. If there is an error the exchange will be ended.
        Parameters:
        callback - The callback to invoke with the request
        charset - The charset that is used to interpret the string
      • receivePartialString

        void receivePartialString​(Receiver.PartialStringCallback callback,
                                  Receiver.ErrorCallback errorCallback,
                                  Charset charset)
        Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. This string will be interpreted according to the specified charset. If there is an error reading the request the error callback will be invoked.
        Parameters:
        callback - The callback to invoke with the request
        errorCallback - The callback that is invoked on error
        charset - The charset that is used to interpret the string
      • receivePartialString

        void receivePartialString​(Receiver.PartialStringCallback callback,
                                  Charset charset)
        Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. This string will be interpreted according to the specified charset. If there is an error the exchange will be ended.
        Parameters:
        callback - The callback to invoke with the request
        charset - The charset that is used to interpret the string
      • receiveFullBytes

        void receiveFullBytes​(Receiver.FullBytesCallback callback,
                              Receiver.ErrorCallback errorCallback)
        Reads the request and invokes the callback when the request body has been fully read. If there is an error reading the request the error callback will be invoked.
        Parameters:
        callback - The callback to invoke with the request
        errorCallback - The callback that is invoked on error
      • receiveFullBytes

        void receiveFullBytes​(Receiver.FullBytesCallback callback)
        Reads the request and invokes the callback when the request body has been fully read. If there is an error the exchange will be ended.
        Parameters:
        callback - The callback to invoke with the request
      • receivePartialBytes

        void receivePartialBytes​(Receiver.PartialBytesCallback callback,
                                 Receiver.ErrorCallback errorCallback)
        Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. If there is an error reading the request the error callback will be invoked.
        Parameters:
        callback - The callback to invoke with the request
        errorCallback - The callback that is invoked on error
      • receivePartialBytes

        void receivePartialBytes​(Receiver.PartialBytesCallback callback)
        Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. If there is an error the exchange will be ended.
        Parameters:
        callback - The callback to invoke with the request
      • pause

        void pause()
        When receiving partial data calling this method will pause the callbacks. Callbacks will not resume until resume() has been called.
      • resume

        void resume()
        Resumes paused callbacks.