Class ChunkEncoder

  • All Implemented Interfaces:
    ContentEncoder

    public class ChunkEncoder
    extends AbstractContentEncoder
    Implements chunked transfer coding. The content is sent in small chunks. Entities transferred using this decoder can be of unlimited length.
    Since:
    4.0
    • Field Detail

      • chunkSizeHint

        private final int chunkSizeHint
    • Method Detail

      • write

        public int write​(java.nio.ByteBuffer src)
                  throws java.io.IOException
        Description copied from interface: ContentEncoder
        Writes a portion of entity content to the underlying channel.
        Parameters:
        src - The buffer from which content is to be retrieved
        Returns:
        The number of bytes read, possibly zero
        Throws:
        java.io.IOException - if I/O error occurs while writing content
      • complete

        public void complete​(java.util.List<? extends Header> trailers)
                      throws java.io.IOException
        Description copied from interface: ContentEncoder
        Terminates the content stream.
        Specified by:
        complete in interface ContentEncoder
        Overrides:
        complete in class AbstractContentEncoder
        Throws:
        java.io.IOException - if I/O error occurs while writing content
      • writeTrailers

        private void writeTrailers​(java.util.List<? extends Header> trailers)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object