Class ChunkedStreamSinkConduit

  • All Implemented Interfaces:
    org.xnio.conduits.Conduit, org.xnio.conduits.SinkConduit, org.xnio.conduits.StreamSinkConduit

    public class ChunkedStreamSinkConduit
    extends org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
    Channel that implements HTTP chunked transfer coding.
    Author:
    Stuart Douglas
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static AttachmentKey<HeaderMap> TRAILERS
      Deprecated.
      • Fields inherited from class org.xnio.conduits.AbstractConduit

        next
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void awaitWritable()  
      void awaitWritable​(long time, java.util.concurrent.TimeUnit timeUnit)  
      boolean flush()  
      void terminateWrites()  
      long transferFrom​(java.nio.channels.FileChannel src, long position, long count)  
      long transferFrom​(org.xnio.channels.StreamSourceChannel source, long count, java.nio.ByteBuffer throughBuffer)  
      void truncateWrites()  
      int write​(java.nio.ByteBuffer src)  
      long write​(java.nio.ByteBuffer[] srcs, int offset, int length)  
      int writeFinal​(java.nio.ByteBuffer src)  
      long writeFinal​(java.nio.ByteBuffer[] srcs, int offset, int length)  
      • Methods inherited from class org.xnio.conduits.AbstractSinkConduit

        getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWrites
      • Methods inherited from class org.xnio.conduits.AbstractConduit

        getWorker
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.xnio.conduits.Conduit

        getWorker
      • Methods inherited from interface org.xnio.conduits.SinkConduit

        getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWrites
    • Field Detail

      • TRAILERS

        @Deprecated
        public static final AttachmentKey<HeaderMap> TRAILERS
        Deprecated.
        Trailers that are to be attached to the end of the HTTP response. Note that it is the callers responsibility to make sure the client understands trailers (i.e. they have provided a TE header), and to set the 'Trailers:' header appropriately.

        This attachment must be set before the terminateWrites() method is called.

    • Constructor Detail

      • ChunkedStreamSinkConduit

        public ChunkedStreamSinkConduit​(org.xnio.conduits.StreamSinkConduit next,
                                        ByteBufferPool bufferPool,
                                        boolean configurable,
                                        boolean passClose,
                                        HeaderMap responseHeaders,
                                        ConduitListener<? super ChunkedStreamSinkConduit> finishListener,
                                        Attachable attachable)
        Construct a new instance.
        Parameters:
        next - the channel to wrap
        configurable - true to allow configuration of the next channel, false otherwise
        passClose - true to close the underlying channel when this channel is closed, false otherwise
        responseHeaders - The response headers
        finishListener - The finish listener
        attachable - The attachable
    • Method Detail

      • write

        public int write​(java.nio.ByteBuffer src)
                  throws java.io.IOException
        Specified by:
        write in interface org.xnio.conduits.StreamSinkConduit
        Overrides:
        write in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException
      • truncateWrites

        public void truncateWrites()
                            throws java.io.IOException
        Specified by:
        truncateWrites in interface org.xnio.conduits.SinkConduit
        Overrides:
        truncateWrites in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException
      • write

        public long write​(java.nio.ByteBuffer[] srcs,
                          int offset,
                          int length)
                   throws java.io.IOException
        Specified by:
        write in interface org.xnio.conduits.StreamSinkConduit
        Overrides:
        write in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException
      • writeFinal

        public long writeFinal​(java.nio.ByteBuffer[] srcs,
                               int offset,
                               int length)
                        throws java.io.IOException
        Specified by:
        writeFinal in interface org.xnio.conduits.StreamSinkConduit
        Overrides:
        writeFinal in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException
      • writeFinal

        public int writeFinal​(java.nio.ByteBuffer src)
                       throws java.io.IOException
        Specified by:
        writeFinal in interface org.xnio.conduits.StreamSinkConduit
        Overrides:
        writeFinal in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException
      • transferFrom

        public long transferFrom​(java.nio.channels.FileChannel src,
                                 long position,
                                 long count)
                          throws java.io.IOException
        Specified by:
        transferFrom in interface org.xnio.conduits.StreamSinkConduit
        Overrides:
        transferFrom in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException
      • transferFrom

        public long transferFrom​(org.xnio.channels.StreamSourceChannel source,
                                 long count,
                                 java.nio.ByteBuffer throughBuffer)
                          throws java.io.IOException
        Specified by:
        transferFrom in interface org.xnio.conduits.StreamSinkConduit
        Overrides:
        transferFrom in class org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException
      • flush

        public boolean flush()
                      throws java.io.IOException
        Specified by:
        flush in interface org.xnio.conduits.SinkConduit
        Overrides:
        flush in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException
      • terminateWrites

        public void terminateWrites()
                             throws java.io.IOException
        Specified by:
        terminateWrites in interface org.xnio.conduits.SinkConduit
        Overrides:
        terminateWrites in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException
      • awaitWritable

        public void awaitWritable()
                           throws java.io.IOException
        Specified by:
        awaitWritable in interface org.xnio.conduits.SinkConduit
        Overrides:
        awaitWritable in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException
      • awaitWritable

        public void awaitWritable​(long time,
                                  java.util.concurrent.TimeUnit timeUnit)
                           throws java.io.IOException
        Specified by:
        awaitWritable in interface org.xnio.conduits.SinkConduit
        Overrides:
        awaitWritable in class org.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
        Throws:
        java.io.IOException