// Path: client/src/main/java/com/nesscomputing/httpclient/HttpClientResponse.java
// public interface HttpClientResponse {
// 	/**
// 	 * Returns the status code for the request.
// 	 *
// 	 * @return the status code, use the related {@link HttpServletRequest} constants
// 	 */
// 	int getStatusCode();
// 
// 	/**
// 	 * Returns the status text for the request.
// 	 *
// 	 * @return the status text
// 	 */
// 	String getStatusText();
// 
// 	/**
// 	 * Returns an input stream for the response body.
// 	 *
// 	 * @return the input stream
// 	 * @throws IOException on error
// 	 */
// 	InputStream getResponseBodyAsStream() throws IOException;
// 
// 	/** @return the URI of the request. */
// 	URI getUri();
// 
// 	/** @return Content type of the response. */
// 	String getContentType();
// 
// 	/**
// 	 * @return Length of the content, if present. Can be null (not present), -1 (chunked) or 0 (no
// 	 *         content).
// 	 */
// 	@CheckForNull
// 	Long getContentLength();
// 
// 	/** @return Content charset if present in the header. Can be null. */
// 	@CheckForNull
// 	String getCharset();
// 
// 	/**
// 	 * @param name the header name
// 	 * @return The named header from the response. Response can be null.
// 	 */
// 	@CheckForNull
// 	String getHeader(String name);
// 
// 	/**
// 	 * @param name the header name
// 	 * @return all values for the given header. Response can be null.
// 	 */
// 	@CheckForNull
// 	List<String> getHeaders(String name);
// 
// 	/** @return Map of header name -> list of values for each header name */
//     @Nonnull
// 	public Map<String, List<String>> getAllHeaders();
// 
// 	/** @return true if the response redirects to another object. */
// 	boolean isRedirected();
// }


import java.io.IOException;
import java.io.InputStream;
import com.nesscomputing.httpclient.HttpClientResponse;
/**
 * Copyright (C) 2012 Ness Computing, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.nesscomputing.httpclient.response;





/**
 * Convert an Input Stream and content type into a result object.
 */
public interface ContentConverter<T>
{
    /**
     * Called when the ContentResponseHandler wants to convert an input stream
     * into a response object. Calling this method does *not* imply a 2xx response code,
     * this method will be called for all response codes if no error occurs while processing
     * the response.
     *
     * @param response The response object from the Http client.
     * @param inputStream The response body as stream.
     * @return The result object. Can be null.
     * @throws IOException
     */
// Path: client/src/main/java/com/nesscomputing/httpclient/HttpClientResponse.java
// public interface HttpClientResponse {
// 	/**
// 	 * Returns the status code for the request.
// 	 *
// 	 * @return the status code, use the related {@link HttpServletRequest} constants
// 	 */
// 	int getStatusCode();
// 
// 	/**
// 	 * Returns the status text for the request.
// 	 *
// 	 * @return the status text
// 	 */
// 	String getStatusText();
// 
// 	/**
// 	 * Returns an input stream for the response body.
// 	 *
// 	 * @return the input stream
// 	 * @throws IOException on error
// 	 */
// 	InputStream getResponseBodyAsStream() throws IOException;
// 
// 	/** @return the URI of the request. */
// 	URI getUri();
// 
// 	/** @return Content type of the response. */
// 	String getContentType();
// 
// 	/**
// 	 * @return Length of the content, if present. Can be null (not present), -1 (chunked) or 0 (no
// 	 *         content).
// 	 */
// 	@CheckForNull
// 	Long getContentLength();
// 
// 	/** @return Content charset if present in the header. Can be null. */
// 	@CheckForNull
// 	String getCharset();
// 
// 	/**
// 	 * @param name the header name
// 	 * @return The named header from the response. Response can be null.
// 	 */
// 	@CheckForNull
// 	String getHeader(String name);
// 
// 	/**
// 	 * @param name the header name
// 	 * @return all values for the given header. Response can be null.
// 	 */
// 	@CheckForNull
// 	List<String> getHeaders(String name);
// 
// 	/** @return Map of header name -> list of values for each header name */
//     @Nonnull
// 	public Map<String, List<String>> getAllHeaders();
// 
// 	/** @return true if the response redirects to another object. */
// 	boolean isRedirected();
// }


// Path: client/src/main/java/com/nesscomputing/httpclient/response/ContentConverter.java
import java.io.IOException;
import java.io.InputStream;
import com.nesscomputing.httpclient.HttpClientResponse;

/**
 * Copyright (C) 2012 Ness Computing, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.nesscomputing.httpclient.response;





/**
 * Convert an Input Stream and content type into a result object.
 */
public interface ContentConverter<T>
{
    /**
     * Called when the ContentResponseHandler wants to convert an input stream
     * into a response object. Calling this method does *not* imply a 2xx response code,
     * this method will be called for all response codes if no error occurs while processing
     * the response.
     *
     * @param response The response object from the Http client.
     * @param inputStream The response body as stream.
     * @return The result object. Can be null.
     * @throws IOException
     */
    T convert(HttpClientResponse response, InputStream inputStream) throws IOException;