Class TemporaryBufferEntity

  • All Implemented Interfaces:
    java.lang.AutoCloseable, org.apache.http.HttpEntity

    public class TemporaryBufferEntity
    extends org.apache.http.entity.AbstractHttpEntity
    implements java.lang.AutoCloseable
    A HttpEntity which takes its content from a TemporaryBuffer
    Since:
    3.3
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private TemporaryBuffer buffer  
      private java.lang.Integer contentLength  
      • Fields inherited from class org.apache.http.entity.AbstractHttpEntity

        chunked, contentEncoding, contentType, OUTPUT_BUFFER_SIZE
    • Constructor Summary

      Constructors 
      Constructor Description
      TemporaryBufferEntity​(TemporaryBuffer buffer)
      Construct a new HttpEntity which will contain the content stored in the specified buffer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close destroys the associated buffer used to buffer the entity
      TemporaryBuffer getBuffer()
      Get the buffer containing the content
      java.io.InputStream getContent()
      long getContentLength()
      boolean isRepeatable()
      boolean isStreaming()
      void setContentLength​(int contentLength)
      Set the contentLength
      void writeTo​(java.io.OutputStream outstream)
      • Methods inherited from class org.apache.http.entity.AbstractHttpEntity

        consumeContent, getContentEncoding, getContentType, isChunked, setChunked, setContentEncoding, setContentEncoding, setContentType, setContentType, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • contentLength

        private java.lang.Integer contentLength
    • Constructor Detail

      • TemporaryBufferEntity

        public TemporaryBufferEntity​(TemporaryBuffer buffer)
        Construct a new HttpEntity which will contain the content stored in the specified buffer
        Parameters:
        buffer -
    • Method Detail

      • getBuffer

        public TemporaryBuffer getBuffer()
        Get the buffer containing the content
        Returns:
        buffer containing the content
      • isRepeatable

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

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

        public java.io.InputStream getContent()
                                       throws java.io.IOException,
                                              java.lang.IllegalStateException
        Specified by:
        getContent in interface org.apache.http.HttpEntity
        Throws:
        java.io.IOException
        java.lang.IllegalStateException
      • 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
      • isStreaming

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

        public void setContentLength​(int contentLength)
        Set the contentLength
        Parameters:
        contentLength -
      • close

        public void close()
        Close destroys the associated buffer used to buffer the entity
        Specified by:
        close in interface java.lang.AutoCloseable
        Since:
        4.5