Class ApacheHttpClient5Transport.ContentCompressingEntity

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.hc.core5.http.EntityDetails, org.apache.hc.core5.http.HttpEntity
    Enclosing class:
    ApacheHttpClient5Transport

    public static class ApacheHttpClient5Transport.ContentCompressingEntity
    extends org.apache.hc.core5.http.io.entity.HttpEntityWrapper
    A gzip compressing entity that also implements getContent().
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getContent()
      Returns a content stream of the entity.
      java.lang.String getContentEncoding()
      Returns content encoding of the entity, if known.
      long getContentLength()
      A gzip entity requires content length in http headers.
      boolean isChunked()
      A gzip compressing entity doesn't work with chunked encoding with sigv4
      void writeTo​(java.io.OutputStream outStream)
      Writes the entity content out to the output stream.
      • Methods inherited from class org.apache.hc.core5.http.io.entity.HttpEntityWrapper

        close, getContentType, getTrailerNames, getTrailers, isRepeatable, isStreaming, toString
      • Methods inherited from class java.lang.Object

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

      • ContentCompressingEntity

        public ContentCompressingEntity​(org.apache.hc.core5.http.HttpEntity entity,
                                        boolean chunkedEnabled)
        Creates a ApacheHttpClient5Transport.ContentCompressingEntity instance with the provided HTTP entity.
        Parameters:
        entity - the HTTP entity.
        chunkedEnabled - force enable/disable chunked transfer-encoding.
    • Method Detail

      • getContentEncoding

        public java.lang.String getContentEncoding()
        Returns content encoding of the entity, if known.
        Specified by:
        getContentEncoding in interface org.apache.hc.core5.http.EntityDetails
        Overrides:
        getContentEncoding in class org.apache.hc.core5.http.io.entity.HttpEntityWrapper
      • getContent

        public java.io.InputStream getContent()
                                       throws java.io.IOException
        Returns a content stream of the entity.
        Specified by:
        getContent in interface org.apache.hc.core5.http.HttpEntity
        Overrides:
        getContent in class org.apache.hc.core5.http.io.entity.HttpEntityWrapper
        Throws:
        java.io.IOException
      • isChunked

        public boolean isChunked()
        A gzip compressing entity doesn't work with chunked encoding with sigv4
        Specified by:
        isChunked in interface org.apache.hc.core5.http.EntityDetails
        Overrides:
        isChunked in class org.apache.hc.core5.http.io.entity.HttpEntityWrapper
        Returns:
        false
      • getContentLength

        public long getContentLength()
        A gzip entity requires content length in http headers.
        Specified by:
        getContentLength in interface org.apache.hc.core5.http.EntityDetails
        Overrides:
        getContentLength in class org.apache.hc.core5.http.io.entity.HttpEntityWrapper
        Returns:
        content length of gzip entity
      • writeTo

        public void writeTo​(java.io.OutputStream outStream)
                     throws java.io.IOException
        Writes the entity content out to the output stream.
        Specified by:
        writeTo in interface org.apache.hc.core5.http.HttpEntity
        Overrides:
        writeTo in class org.apache.hc.core5.http.io.entity.HttpEntityWrapper
        Parameters:
        outStream - the output stream to write entity content to
        Throws:
        java.io.IOException - if an I/O error occurs