org.apache.wink.client.handlers
Interface InputStreamAdapter


public interface InputStreamAdapter

Interface for adapting the input stream


Method Summary
 java.io.InputStream adapt(java.io.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

java.io.InputStream adapt(java.io.InputStream is,
                          ClientResponse response)
                          throws java.io.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:
java.io.IOException


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