public class RepeatableInputStreamEntity extends CloseableInputStreamEntity
CloseableInputStreamEntity
that can be read via getContent()
or writeTo(OutputStream)
multiple times.Constructor and Description |
---|
RepeatableInputStreamEntity(InputStream input,
long length,
org.apache.http.entity.ContentType contentType)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
InputStream |
getContent()
The input stream will be reset prior to being returned
|
boolean |
isRepeatable()
Always returns true
|
void |
writeTo(OutputStream outstream)
The input stream will be closed prior to being written to the provided
OutputStream |
close
consumeContent, getContentEncoding, getContentType, isChunked, setChunked, setContentEncoding, setContentEncoding, setContentType, setContentType, toString
public RepeatableInputStreamEntity(InputStream input, long length, org.apache.http.entity.ContentType contentType)
InputStream.reset()
will position the stream at the position it was in when passed to this
constructor.input
- the input stream (required to support mark/rest)length
- the length of the input streamcontentType
- the content type of the input streampublic boolean isRepeatable()
isRepeatable
in interface org.apache.http.HttpEntity
isRepeatable
in class org.apache.http.entity.InputStreamEntity
public InputStream getContent() throws IOException
getContent
in interface org.apache.http.HttpEntity
getContent
in class org.apache.http.entity.InputStreamEntity
IOException
public void writeTo(OutputStream outstream) throws IOException
OutputStream
writeTo
in interface org.apache.http.HttpEntity
writeTo
in class org.apache.http.entity.InputStreamEntity
IOException