Class DecompressingEntity

java.lang.Object
org.apache.hc.core5.http.io.entity.HttpEntityWrapper
org.apache.hc.client5.http.entity.compress.DecompressingEntity
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hc.core5.http.EntityDetails, org.apache.hc.core5.http.HttpEntity

public class DecompressingEntity extends org.apache.hc.core5.http.io.entity.HttpEntityWrapper
  • Field Details

  • Constructor Details

    • DecompressingEntity

      public DecompressingEntity(org.apache.hc.core5.http.HttpEntity src, org.apache.hc.core5.io.IOFunction<InputStream, InputStream> decoder)
  • Method Details

    • getDecompressingStream

      private InputStream getDecompressingStream() throws IOException
      Throws:
      IOException
    • getContent

      public InputStream getContent() throws IOException
      Returns the cached decoded stream, creating it once if necessary.
      Specified by:
      getContent in interface org.apache.hc.core5.http.HttpEntity
      Overrides:
      getContent in class org.apache.hc.core5.http.io.entity.HttpEntityWrapper
      Throws:
      IOException
    • getContentLength

      public long getContentLength()
      Length is unknown after decompression.
      Specified by:
      getContentLength in interface org.apache.hc.core5.http.EntityDetails
      Overrides:
      getContentLength in class org.apache.hc.core5.http.io.entity.HttpEntityWrapper
    • getContentEncoding

      public String getContentEncoding()
      Content is no longer encoded
      Specified by:
      getContentEncoding in interface org.apache.hc.core5.http.EntityDetails
      Overrides:
      getContentEncoding in class org.apache.hc.core5.http.io.entity.HttpEntityWrapper
    • writeTo

      public void writeTo(OutputStream out) throws IOException
      Streams the decoded bytes directly to out.
      Specified by:
      writeTo in interface org.apache.hc.core5.http.HttpEntity
      Overrides:
      writeTo in class org.apache.hc.core5.http.io.entity.HttpEntityWrapper
      Throws:
      IOException