org.apache.wink.client.handlers
Interface InputStreamAdapter


public interface InputStreamAdapter

Interface for adapting the input stream


Method Summary
 InputStream adapt(InputStream is, ClientResponse response)
          This method is called in order to wrap the response input stream with another input stream to allow the manipulation of the response entity stream.
 

Method Detail

adapt

InputStream adapt(InputStream is,
                  ClientResponse response)
                  throws IOException
This method is called in order to wrap the response input stream with another input stream to allow the manipulation of the response entity stream. This method is called after reading the response status code and response headers, and before returning to the ClientResponse to the handlers on the chain.

For example:

 public InputStream adapt(InputStream is, ClientResponse response) throws IOException {
     String header = response.getHeaders().getFirst("Content-Encoding");
     if (header != null && header.equalsIgnoreCase("gzip")) {
         return new GZIPInputStream(is);
     }
     return is;
 }
 

Parameters:
is - the current response input stream
response - the response
Returns:
the adapted response input stream
Throws:
IOException


Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.