java.lang.Object | ||
↳ | org.apache.http.entity.AbstractHttpEntity | |
↳ | org.apache.http.nio.entity.NFileEntity |
A self contained, repeatable non-blocking entity that retrieves its content from a file. This class is mostly used to stream large files of different types, so one needs to supply the content type of the file to make sure the content can be correctly recognized and processed by the recipient.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.http.entity.AbstractHttpEntity
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates new instance of NFileEntity from the given source
File
with the given content type. | |||||||||||
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Notification that any resources allocated for writing can be released.
| |||||||||||
Notification that content should be written to the encoder.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.http.entity.AbstractHttpEntity
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.apache.http.HttpEntity
| |||||||||||
From interface
org.apache.http.nio.entity.ProducingNHttpEntity
|
Creates new instance of NFileEntity from the given source File
with the given content type. If useFileChannels
is set to
true
, the entity will try to use FileContentEncoder
interface to stream file content directly from the file channel.
file | the source file. |
---|---|
contentType | the content type of the file. |
useFileChannels | flag whether the direct transfer from the file channel should be attempted. |
Notification that any resources allocated for writing can be released.
Notification that content should be written to the encoder.
IOControl
instance passed as a parameter to the method can be
used to suspend output events if the entity is temporarily unable to
produce more content.
When all content is finished, this MUST call complete()
.
Failure to do so could result in the entity never being written.
encoder | content encoder. |
---|---|
ioctrl | I/O control of the underlying connection. |
IOException |
---|