Class BufferingResponseListener

    • Constructor Detail

      • BufferingResponseListener

        public BufferingResponseListener()
        Deprecated.
        Creates an instance with a default maximum length of 2 MiB.
      • BufferingResponseListener

        public BufferingResponseListener​(int maxLength)
        Deprecated.
        Creates an instance with the given maximum length
        Parameters:
        maxLength - the maximum length of the content
    • Method Detail

      • onHeaders

        public void onHeaders​(Response response)
        Deprecated.
        Description copied from interface: Response.HeadersListener
        Callback method invoked when all the response headers have been received and parsed.
        Parameters:
        response - the response containing the response line data and the headers
      • onContent

        public void onContent​(Response response,
                              java.nio.ByteBuffer content)
        Deprecated.
        Description copied from interface: Response.ContentListener
        Callback method invoked when the response content has been received, parsed and there is demand. This method may be invoked multiple times, and the content buffer must be consumed (or copied) before returning from this method.
        Parameters:
        response - the response containing the response line data and the headers
        content - the content bytes received
      • onComplete

        public abstract void onComplete​(Result result)
        Deprecated.
        Description copied from interface: Response.CompleteListener
        Callback method invoked when the request and the response have been processed, either successfully or not.

        The result parameter contains the request, the response, and eventual failures.

        Requests may complete after response, for example in case of big uploads that are discarded or read asynchronously by the server. This method is always invoked after Response.SuccessListener.onSuccess(Response) or Response.FailureListener.onFailure(Response, Throwable), and only when request indicates that it is completed.

        Parameters:
        result - the result of the request / response exchange
      • getMediaType

        public java.lang.String getMediaType()
        Deprecated.
      • getEncoding

        public java.lang.String getEncoding()
        Deprecated.
      • getContent

        public byte[] getContent()
        Deprecated.
        Returns:
        the content as bytes
        See Also:
        getContentAsString()
      • getContentAsString

        public java.lang.String getContentAsString()
        Deprecated.
        Returns:
        the content as a string, using the "Content-Type" header to detect the encoding or defaulting to UTF-8 if the encoding could not be detected.
        See Also:
        getContentAsString(String)
      • getContentAsString

        public java.lang.String getContentAsString​(java.lang.String encoding)
        Deprecated.
        Parameters:
        encoding - the encoding of the content bytes
        Returns:
        the content as a string, with the specified encoding
        See Also:
        getContentAsString()
      • getContentAsString

        public java.lang.String getContentAsString​(java.nio.charset.Charset encoding)
        Deprecated.
        Parameters:
        encoding - the encoding of the content bytes
        Returns:
        the content as a string, with the specified encoding
        See Also:
        getContentAsString()
      • getContentAsInputStream

        public java.io.InputStream getContentAsInputStream()
        Deprecated.
        Returns:
        Content as InputStream