org.apache.http.entity
Class BufferedHttpEntityHC4

java.lang.Object
  extended by org.apache.http.entity.HttpEntityWrapperHC4
      extended by org.apache.http.entity.BufferedHttpEntityHC4
All Implemented Interfaces:
org.apache.http.HttpEntity

@NotThreadSafe
public class BufferedHttpEntityHC4
extends HttpEntityWrapperHC4

A wrapping entity that buffers it content if necessary. The buffered entity is always repeatable. If the wrapped entity is repeatable itself, calls are passed through. If the wrapped entity is not repeatable, the content is read into a buffer once and provided from there as often as required.

Since:
4.0

Field Summary
 
Fields inherited from class org.apache.http.entity.HttpEntityWrapperHC4
wrappedEntity
 
Constructor Summary
BufferedHttpEntityHC4(org.apache.http.HttpEntity entity)
          Creates a new buffered entity wrapper.
 
Method Summary
 java.io.InputStream getContent()
           
 long getContentLength()
           
 boolean isChunked()
          Tells that this entity does not have to be chunked.
 boolean isRepeatable()
          Tells that this entity is repeatable.
 boolean isStreaming()
           
 void writeTo(java.io.OutputStream outstream)
           
 
Methods inherited from class org.apache.http.entity.HttpEntityWrapperHC4
consumeContent, getContentEncoding, getContentType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedHttpEntityHC4

public BufferedHttpEntityHC4(org.apache.http.HttpEntity entity)
                      throws java.io.IOException
Creates a new buffered entity wrapper.

Parameters:
entity - the entity to wrap, not null
Throws:
java.lang.IllegalArgumentException - if wrapped is null
java.io.IOException
Method Detail

getContentLength

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

getContent

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

isChunked

public boolean isChunked()
Tells that this entity does not have to be chunked.

Specified by:
isChunked in interface org.apache.http.HttpEntity
Overrides:
isChunked in class HttpEntityWrapperHC4
Returns:
false

isRepeatable

public boolean isRepeatable()
Tells that this entity is repeatable.

Specified by:
isRepeatable in interface org.apache.http.HttpEntity
Overrides:
isRepeatable in class HttpEntityWrapperHC4
Returns:
true

writeTo

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

isStreaming

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