com.google.api.client.testing.http
Class MockHttpContent

java.lang.Object
  extended by com.google.api.client.testing.http.MockHttpContent
All Implemented Interfaces:
HttpContent

public class MockHttpContent
extends Object
implements HttpContent

Mock for HttpContent.

Since:
1.3
Author:
Yaniv Inbar

Field Summary
 byte[] content
          HTTP content or an empty byte array by default.
 String encoding
          HTTP content encoding or null by default.
 long length
          HTTP content length or -1 by default.
 String type
          HTTP content type or null by default.
 
Constructor Summary
MockHttpContent()
           
 
Method Summary
 String getEncoding()
          Returns the content encoding (for example "gzip") or null for none.
 long getLength()
          Returns the content length or less than zero if not known.
 String getType()
          Returns the content type or null for none.
 boolean retrySupported()
          Returns whether or not retry is supported on this content type.
 void writeTo(OutputStream out)
          Writes the content to the given output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

encoding

public String encoding
HTTP content encoding or null by default.


length

public long length
HTTP content length or -1 by default.


type

public String type
HTTP content type or null by default.


content

public byte[] content
HTTP content or an empty byte array by default.

Constructor Detail

MockHttpContent

public MockHttpContent()
Method Detail

getEncoding

public String getEncoding()
Description copied from interface: HttpContent
Returns the content encoding (for example "gzip") or null for none.

Specified by:
getEncoding in interface HttpContent

getLength

public long getLength()
               throws IOException
Description copied from interface: HttpContent
Returns the content length or less than zero if not known.

Specified by:
getLength in interface HttpContent
Throws:
IOException

getType

public String getType()
Description copied from interface: HttpContent
Returns the content type or null for none.

Specified by:
getType in interface HttpContent

writeTo

public void writeTo(OutputStream out)
             throws IOException
Description copied from interface: HttpContent
Writes the content to the given output stream.

Specified by:
writeTo in interface HttpContent
Throws:
IOException

retrySupported

public boolean retrySupported()
Description copied from interface: HttpContent
Returns whether or not retry is supported on this content type. This is a backward incompatible change that affects versions prior to 1.4.

Specified by:
retrySupported in interface HttpContent


Copyright © 2010-2011 Google. All Rights Reserved.