Package com.google.api.client.http
Class LowLevelHttpResponse
- java.lang.Object
-
- com.google.api.client.http.LowLevelHttpResponse
-
- Direct Known Subclasses:
MockLowLevelHttpResponse
public abstract class LowLevelHttpResponse extends Object
Low-level HTTP response.This allows providing a different implementation of the HTTP response that is more compatible with the Java environment used.
Implementation has no fields and therefore thread-safe, but sub-classes are not necessarily thread-safe.
- Since:
- 1.0
- Author:
- Yaniv Inbar
-
-
Constructor Summary
Constructors Constructor Description LowLevelHttpResponse()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddisconnect()Default implementation does nothing, but subclasses may override to attempt to abort the connection or release allocated system resources for this connection.abstract InputStreamgetContent()Returns the HTTP response content input stream ornullfor none.abstract StringgetContentEncoding()Returns the content encoding (for example"gzip") ornullfor none.abstract longgetContentLength()Returns the content length or0for none.abstract StringgetContentType()Returns the content type ornullfor none.abstract intgetHeaderCount()Returns the number of HTTP response headers.abstract StringgetHeaderName(int index)Returns the HTTP response header name at the given zero-based index.abstract StringgetHeaderValue(int index)Returns the HTTP response header value at the given zero-based index.abstract StringgetReasonPhrase()Returns the HTTP reason phrase ornullfor none.abstract intgetStatusCode()Returns the response status code or<=0for none.abstract StringgetStatusLine()Returns the response status line ornullfor none.
-
-
-
Method Detail
-
getContent
public abstract InputStream getContent() throws IOException
Returns the HTTP response content input stream ornullfor none.- Throws:
IOException- I/O exception
-
getContentEncoding
public abstract String getContentEncoding() throws IOException
Returns the content encoding (for example"gzip") ornullfor none.- Throws:
IOException
-
getContentLength
public abstract long getContentLength() throws IOExceptionReturns the content length or0for none.- Throws:
IOException
-
getContentType
public abstract String getContentType() throws IOException
Returns the content type ornullfor none.- Throws:
IOException
-
getStatusLine
public abstract String getStatusLine() throws IOException
Returns the response status line ornullfor none.- Throws:
IOException
-
getStatusCode
public abstract int getStatusCode() throws IOExceptionReturns the response status code or<=0for none.- Throws:
IOException
-
getReasonPhrase
public abstract String getReasonPhrase() throws IOException
Returns the HTTP reason phrase ornullfor none.- Throws:
IOException
-
getHeaderCount
public abstract int getHeaderCount() throws IOExceptionReturns the number of HTTP response headers.Note that multiple headers of the same name need to be supported, in which case each header value is treated as a separate header.
- Throws:
IOException
-
getHeaderName
public abstract String getHeaderName(int index) throws IOException
Returns the HTTP response header name at the given zero-based index.- Throws:
IOException
-
getHeaderValue
public abstract String getHeaderValue(int index) throws IOException
Returns the HTTP response header value at the given zero-based index.- Throws:
IOException
-
disconnect
public void disconnect() throws IOExceptionDefault implementation does nothing, but subclasses may override to attempt to abort the connection or release allocated system resources for this connection.- Throws:
IOException- I/O exception- Since:
- 1.4
-
-