Package com.google.api.client.http
Class LowLevelHttpResponse
- java.lang.Object
-
- com.google.api.client.http.LowLevelHttpResponse
-
- Direct Known Subclasses:
ApacheHttpResponse
,MockLowLevelHttpResponse
,NetHttpResponse
public abstract class LowLevelHttpResponse extends java.lang.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
-
-
Constructor Summary
Constructors Constructor Description LowLevelHttpResponse()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
disconnect()
Default implementation does nothing, but subclasses may override to attempt to abort the connection or release allocated system resources for this connection.abstract java.io.InputStream
getContent()
Returns the HTTP response content input stream ornull
for none.abstract java.lang.String
getContentEncoding()
Returns the content encoding (for example"gzip"
) ornull
for none.abstract long
getContentLength()
Returns the content length or0
for none.abstract java.lang.String
getContentType()
Returns the content type ornull
for none.abstract int
getHeaderCount()
Returns the number of HTTP response headers.abstract java.lang.String
getHeaderName(int index)
Returns the HTTP response header name at the given zero-based index.abstract java.lang.String
getHeaderValue(int index)
Returns the HTTP response header value at the given zero-based index.abstract java.lang.String
getReasonPhrase()
Returns the HTTP reason phrase ornull
for none.abstract int
getStatusCode()
Returns the response status code or<=0
for none.abstract java.lang.String
getStatusLine()
Returns the response status line ornull
for none.
-
-
-
Method Detail
-
getContent
public abstract java.io.InputStream getContent() throws java.io.IOException
Returns the HTTP response content input stream ornull
for none.- Throws:
java.io.IOException
- I/O exception
-
getContentEncoding
public abstract java.lang.String getContentEncoding() throws java.io.IOException
Returns the content encoding (for example"gzip"
) ornull
for none.- Throws:
java.io.IOException
-
getContentLength
public abstract long getContentLength() throws java.io.IOException
Returns the content length or0
for none.- Throws:
java.io.IOException
-
getContentType
public abstract java.lang.String getContentType() throws java.io.IOException
Returns the content type ornull
for none.- Throws:
java.io.IOException
-
getStatusLine
public abstract java.lang.String getStatusLine() throws java.io.IOException
Returns the response status line ornull
for none.- Throws:
java.io.IOException
-
getStatusCode
public abstract int getStatusCode() throws java.io.IOException
Returns the response status code or<=0
for none.- Throws:
java.io.IOException
-
getReasonPhrase
public abstract java.lang.String getReasonPhrase() throws java.io.IOException
Returns the HTTP reason phrase ornull
for none.- Throws:
java.io.IOException
-
getHeaderCount
public abstract int getHeaderCount() throws java.io.IOException
Returns 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:
java.io.IOException
-
getHeaderName
public abstract java.lang.String getHeaderName(int index) throws java.io.IOException
Returns the HTTP response header name at the given zero-based index.- Throws:
java.io.IOException
-
getHeaderValue
public abstract java.lang.String getHeaderValue(int index) throws java.io.IOException
Returns the HTTP response header value at the given zero-based index.- Throws:
java.io.IOException
-
disconnect
public void disconnect() throws java.io.IOException
Default implementation does nothing, but subclasses may override to attempt to abort the connection or release allocated system resources for this connection.- Throws:
java.io.IOException
- I/O exception- Since:
- 1.4
-
-