Class AbstractContentEncoder

    • Constructor Detail

      • AbstractContentEncoder

        public AbstractContentEncoder​(WritableByteChannel channel,
                                      SessionOutputBuffer buffer,
                                      HttpTransportMetricsImpl metrics)
        Creates an instance of this class.
        Parameters:
        channel - the destination channel.
        buffer - the session output buffer that can be used to store session data for intermediate processing.
        metrics - Transport metrics of the underlying HTTP transport.
    • Method Detail

      • isCompleted

        public boolean isCompleted()
        Description copied from interface: ContentEncoder
        Returns true if the entity has been transferred in its entirety.
        Specified by:
        isCompleted in interface ContentEncoder
        Returns:
        true if all the content has been produced, false otherwise.
      • assertNotCompleted

        protected void assertNotCompleted()
      • flushToChannel

        protected int flushToChannel()
                              throws IOException
        Flushes content of the session buffer to the channel and updates transport metrics.
        Returns:
        number of bytes written to the channel.
        Throws:
        IOException
        Since:
        4.3
      • writeToChannel

        protected int writeToChannel​(ByteBuffer src)
                              throws IOException
        Flushes content of the given buffer to the channel and updates transport metrics.
        Returns:
        number of bytes written to the channel.
        Throws:
        IOException
        Since:
        4.3
      • writeToChannel

        protected int writeToChannel​(ByteBuffer src,
                                     int limit)
                              throws IOException
        Transfers content of the source to the channel and updates transport metrics.
        Parameters:
        src - source.
        limit - max number of bytes to transfer.
        Returns:
        number of bytes transferred.
        Throws:
        IOException
        Since:
        4.3
      • writeToBuffer

        protected int writeToBuffer​(ByteBuffer src,
                                    int limit)
                             throws IOException
        Transfers content of the source to the buffer and updates transport metrics.
        Parameters:
        src - source.
        limit - max number of bytes to transfer.
        Returns:
        number of bytes transferred.
        Throws:
        IOException
        Since:
        4.3