|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.api.client.http.LowLevelHttpResponse
com.google.api.client.testing.http.MockLowLevelHttpResponse
public class MockLowLevelHttpResponse
Mock for LowLevelHttpResponse.
| Field Summary | |
|---|---|
InputStream |
content
Input stream content of HTTP response or null by default. |
String |
contentType
Content type of HTTP response or null by default. |
ArrayList<String> |
headerNames
List of header names of HTTP response (empty array list by default). |
ArrayList<String> |
headerValues
List of header values of HTTP response (empty array list by default). |
int |
statusCode
Status code of HTTP response or 200 by default. |
| Constructor Summary | |
|---|---|
MockLowLevelHttpResponse()
|
|
| Method Summary | |
|---|---|
void |
addHeader(String name,
String value)
Adds a header to the response. |
InputStream |
getContent()
Returns the HTTP response content input stream or null for none. |
String |
getContentEncoding()
Returns the content encoding (for example "gzip") or null for none. |
long |
getContentLength()
Returns the content length or 0 for none. |
String |
getContentType()
Returns the content type or null for none. |
int |
getHeaderCount()
Returns the number of HTTP response headers. |
String |
getHeaderName(int index)
Returns the HTTP response header name at the given zero-based index. |
String |
getHeaderValue(int index)
Returns the HTTP response header value at the given zero-based index. |
String |
getReasonPhrase()
Returns the HTTP reason phrase or null for none. |
int |
getStatusCode()
Returns the response status code or 0 for none. |
String |
getStatusLine()
Returns the response status line or null for none. |
void |
setContent(String stringContent)
Sets the response content to the given content string. |
| Methods inherited from class com.google.api.client.http.LowLevelHttpResponse |
|---|
disconnect |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public InputStream content
null by default.
public String contentType
null by default.
public int statusCode
200 by default.
public ArrayList<String> headerNames
public ArrayList<String> headerValues
| Constructor Detail |
|---|
public MockLowLevelHttpResponse()
| Method Detail |
|---|
public void addHeader(String name,
String value)
name - header namevalue - header valuepublic void setContent(String stringContent)
stringContent - content string
public InputStream getContent()
throws IOException
LowLevelHttpResponsenull for none.
getContent in class LowLevelHttpResponseIOException - I/O exceptionpublic String getContentEncoding()
LowLevelHttpResponse"gzip") or null for none.
getContentEncoding in class LowLevelHttpResponsepublic long getContentLength()
LowLevelHttpResponse0 for none.
getContentLength in class LowLevelHttpResponsepublic String getContentType()
LowLevelHttpResponsenull for none.
getContentType in class LowLevelHttpResponsepublic int getHeaderCount()
LowLevelHttpResponseNote that multiple headers of the same name need to be supported, in which case each header value is treated as a separate header.
getHeaderCount in class LowLevelHttpResponsepublic String getHeaderName(int index)
LowLevelHttpResponse
getHeaderName in class LowLevelHttpResponsepublic String getHeaderValue(int index)
LowLevelHttpResponse
getHeaderValue in class LowLevelHttpResponsepublic String getReasonPhrase()
LowLevelHttpResponsenull for none.
getReasonPhrase in class LowLevelHttpResponsepublic int getStatusCode()
LowLevelHttpResponse0 for none.
getStatusCode in class LowLevelHttpResponsepublic String getStatusLine()
LowLevelHttpResponsenull for none.
getStatusLine in class LowLevelHttpResponse
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||