public interface HttpContent extends StreamingContent
Implementations don't need to be thread-safe.
Modifier and Type | Method and Description |
---|---|
String |
getEncoding()
Deprecated.
(scheduled to be removed in 1.15) Use
HttpEncoding instead |
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 byte content to the given output stream.
|
long getLength() throws IOException
IOException
@Deprecated String getEncoding()
HttpEncoding
instead"gzip"
) or null
for none.String getType()
null
for none.boolean retrySupported()
void writeTo(OutputStream out) throws IOException
Implementations must not close the output stream, and instead should flush the output stream. Some callers may assume that the the output stream has not been closed, and will fail to work if it has been closed.
Upgrade warning: in prior version 1.13 the implementation of this method was allowed to close the stream, but starting with 1.14 closing the stream is no longer allowed.
writeTo
in interface StreamingContent
out
- output streamIOException
Copyright © 2011-2013 Google. All Rights Reserved.