Class MockHttpContent
java.lang.Object
com.google.api.client.testing.http.MockHttpContent
- All Implemented Interfaces:
HttpContent, StreamingContent
- Since:
- 1.3
- Author:
- Yaniv Inbar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal byte[]Returns the HTTP content.longReturns the content length or less than zero if not known.getType()Returns the content type ornullfor none.booleanReturns whether or not retry is supported on this content type.setContent(byte[] content) Sets the HTTP content.setLength(long length) Returns the HTTP content length or-1for unknown.Sets the HTTP content type ornullfor none.voidwriteTo(OutputStream out) Writes the byte content to the given output stream.
-
Constructor Details
-
MockHttpContent
public MockHttpContent()
-
-
Method Details
-
getLength
Description copied from interface:HttpContentReturns the content length or less than zero if not known.- Specified by:
getLengthin interfaceHttpContent- Throws:
IOException
-
getType
Description copied from interface:HttpContentReturns the content type ornullfor none.- Specified by:
getTypein interfaceHttpContent
-
writeTo
Description copied from interface:StreamingContentWrites the byte content to the given output stream.Implementations must not close the output stream, and instead should flush the output stream. Some callers may assume that the output stream has not been closed, and will fail to work if it has been closed.
- Specified by:
writeToin interfaceHttpContent- Specified by:
writeToin interfaceStreamingContent- Parameters:
out- output stream- Throws:
IOException
-
retrySupported
public boolean retrySupported()Description copied from interface:HttpContentReturns whether or not retry is supported on this content type.- Specified by:
retrySupportedin interfaceHttpContent
-
getContent
public final byte[] getContent()Returns the HTTP content.- Since:
- 1.5
-
setContent
Sets the HTTP content.Default value is an empty byte array.
- Since:
- 1.5
-
setLength
Returns the HTTP content length or-1for unknown.Default value is
-1.- Since:
- 1.5
-
setType
-