|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.api.client.http.AbstractInputStreamContent
com.google.api.client.http.ByteArrayContent
public final class ByteArrayContent
Concrete implementation of AbstractInputStreamContent that generates repeatable input
streams based on the contents of byte array.
The AbstractInputStreamContent.type field is required.
Sample use:
static void setRequestJsonContent(HttpRequest request, String json) {
InputStreamContent content = new ByteArrayContent(json);
content.type = "application/json";
request.content = content;
}
| Field Summary |
|---|
| Fields inherited from class com.google.api.client.http.AbstractInputStreamContent |
|---|
encoding, type |
| Constructor Summary | |
|---|---|
ByteArrayContent()
Create an instance with no data. |
|
ByteArrayContent(byte[] array)
|
|
ByteArrayContent(String contentString)
Create an instance from the byte contents of the string. |
|
| Method Summary | |
|---|---|
protected InputStream |
getInputStream()
Return an input stream for the specific implementation type of AbstractInputStreamContent. |
long |
getLength()
Returns the content length or less than zero if not known. |
boolean |
retrySupported()
Returns whether or not retry is supported on this content type. |
| Methods inherited from class com.google.api.client.http.AbstractInputStreamContent |
|---|
copy, getEncoding, getType, writeTo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ByteArrayContent(byte[] array)
array - Data source for creating input streams.public ByteArrayContent(String contentString)
Strings.toBytesUtf8() to perform the conversion.
contentString - String to use as the source data for creating input streamspublic ByteArrayContent()
| Method Detail |
|---|
public long getLength()
HttpContent
public boolean retrySupported()
HttpContent
protected InputStream getInputStream()
AbstractInputStreamContentAbstractInputStreamContent. If the specific implementation will return true for
HttpContent.retrySupported() this should be a factory function which will create a new
InputStream from the source data whenever invoked.
getInputStream in class AbstractInputStreamContent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||