org.apache.http.nio.entity
Class NFileEntity

java.lang.Object
  extended by org.apache.http.entity.AbstractHttpEntity
      extended by org.apache.http.nio.entity.NFileEntity
All Implemented Interfaces:
org.apache.http.HttpEntity, ProducingNHttpEntity

public class NFileEntity
extends org.apache.http.entity.AbstractHttpEntity
implements ProducingNHttpEntity

An entity whose content is retrieved from from a file.

Since:
4.0
Version:
$Revision: 632746 $
Author:
Sam Berlin

Field Summary
 
Fields inherited from class org.apache.http.entity.AbstractHttpEntity
chunked, contentEncoding, contentType
 
Constructor Summary
NFileEntity(java.io.File file, java.lang.String contentType)
           
NFileEntity(java.io.File file, java.lang.String contentType, boolean useFileChannels)
           
 
Method Summary
 void finish()
          Notification that any resources allocated for writing can be released.
 java.io.InputStream getContent()
           
 long getContentLength()
           
 boolean isRepeatable()
           
 boolean isStreaming()
           
 void produceContent(ContentEncoder encoder, IOControl ioctrl)
          Notification that content should be written to the encoder.
 void writeTo(java.io.OutputStream outstream)
           
 
Methods inherited from class org.apache.http.entity.AbstractHttpEntity
consumeContent, getContentEncoding, getContentType, isChunked, setChunked, setContentEncoding, setContentEncoding, setContentType, setContentType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.http.HttpEntity
consumeContent, getContentEncoding, getContentType, isChunked
 

Constructor Detail

NFileEntity

public NFileEntity(java.io.File file,
                   java.lang.String contentType,
                   boolean useFileChannels)

NFileEntity

public NFileEntity(java.io.File file,
                   java.lang.String contentType)
Method Detail

finish

public void finish()
Description copied from interface: ProducingNHttpEntity
Notification that any resources allocated for writing can be released.

Specified by:
finish in interface ProducingNHttpEntity

getContentLength

public long getContentLength()
Specified by:
getContentLength in interface org.apache.http.HttpEntity

isRepeatable

public boolean isRepeatable()
Specified by:
isRepeatable in interface org.apache.http.HttpEntity

produceContent

public void produceContent(ContentEncoder encoder,
                           IOControl ioctrl)
                    throws java.io.IOException
Description copied from interface: ProducingNHttpEntity
Notification that content should be written to the encoder. When all content is finished, this MUST call ContentEncoder.complete(). Failure to do so could result in the entity never being written.

Specified by:
produceContent in interface ProducingNHttpEntity
Throws:
java.io.IOException

isStreaming

public boolean isStreaming()
Specified by:
isStreaming in interface org.apache.http.HttpEntity

getContent

public java.io.InputStream getContent()
                               throws java.io.IOException
Specified by:
getContent in interface org.apache.http.HttpEntity
Throws:
java.io.IOException

writeTo

public void writeTo(java.io.OutputStream outstream)
             throws java.io.IOException
Specified by:
writeTo in interface org.apache.http.HttpEntity
Throws:
java.io.IOException


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.