org.apache.http.nio.entity
Class NByteArrayEntity

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

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

An entity whose content is retrieved from a byte array.

Since:
4.0
Version:
$Revision: 630662 $
Author:
Sam Berlin
See Also:
AsyncNHttpServiceHandler

Field Summary
protected  java.nio.ByteBuffer buffer
           
protected  byte[] content
           
 
Fields inherited from class org.apache.http.entity.AbstractHttpEntity
chunked, contentEncoding, contentType
 
Constructor Summary
NByteArrayEntity(byte[] b)
           
 
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
 

Field Detail

content

protected final byte[] content

buffer

protected final java.nio.ByteBuffer buffer
Constructor Detail

NByteArrayEntity

public NByteArrayEntity(byte[] b)
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

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

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

isStreaming

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

getContent

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

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.