io.undertow.protocols.http2

## Class Http2DataStreamSinkChannel

- java.lang.Object
- - io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>
  - - io.undertow.protocols.http2.AbstractHttp2StreamSinkChannel
    - - io.undertow.protocols.http2.Http2StreamSinkChannel
      - - io.undertow.protocols.http2.Http2DataStreamSinkChannel

All Implemented Interfaces:
  Http2Stream, Closeable, AutoCloseable, Channel, GatheringByteChannel, InterruptibleChannel, WritableByteChannel, org.xnio.channels.CloseableChannel, org.xnio.channels.Configurable, org.xnio.channels.StreamSinkChannel, org.xnio.channels.SuspendableWriteChannel

Direct Known Subclasses:
  Http2HeadersStreamSinkChannel, Http2PushPromiseStreamSinkChannel

    public class Http2DataStreamSinkChannel
    extends Http2StreamSinkChannel
    implements Http2Stream

Headers channel

Author:
  Stuart Douglas

### Nested Class Summary

Nested Classes
`static interface` `Http2DataStreamSinkChannel.TrailersProducer`

### Field Summary

### Fields inherited from interface org.xnio.channels.Configurable

`EMPTY`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `channelForciblyClosed()` Called when a channel has been forcibly closed, and data (frames) have already been written.
`protected SendFrameHeader` `createFrameHeaderImpl()`
`boolean` `flush()`
`org.xnio.ChannelListener<Http2DataStreamSinkChannel>` `getCompletionListener()`
`HeaderMap` `getHeaders()`
`Http2DataStreamSinkChannel.TrailersProducer` `getTrailersProducer()`
`protected void` `handleFlushComplete(boolean finalFrame)`
`protected boolean` `isFlushRequiredOnEmptyBuffer()`
`void` `setCompletionListener(org.xnio.ChannelListener<Http2DataStreamSinkChannel> completionListener)`
`void` `setTrailersProducer(Http2DataStreamSinkChannel.TrailersProducer trailersProducer)`
`int` `write(ByteBuffer src)`
`long` `write(ByteBuffer[] srcs)`
`long` `write(ByteBuffer[] srcs, int offset, int length)`
`protected void` `writeBeforeHeaderBlock(ByteBuffer buffer)`
`int` `writeFinal(ByteBuffer src)`
`long` `writeFinal(ByteBuffer[] srcs)`
`long` `writeFinal(ByteBuffer[] srcs, int offset, int length)`

### Methods inherited from class io.undertow.protocols.http2.Http2StreamSinkChannel

`allocateAll, awaitWritable, awaitWritable, createFrameHeader, getStreamId, grabFlowControlBytes`

### Methods inherited from class io.undertow.protocols.http2.AbstractHttp2StreamSinkChannel

`isLastFrame`

### Methods inherited from class io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel

`close, getAwaitWritableTimeout, getBuffer, getChannel, getCloseSetter, getIoThread, getOption, getWorker, getWriteSetter, getWriteThread, isBroken, isBufferFull, isFinalFrameQueued, isFirstDataWritten, isOpen, isReadyForFlush, isWriteResumed, isWritesShutdown, markBroken, preWriteTransform, resumeWrites, resumeWritesInternal, safeToSend, send, sendInternal, setOption, shutdownWrites, supportsOption, suspendWrites, transferFrom, transferFrom, wakeupWrites`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface io.undertow.protocols.http2.Http2Stream

`getStreamId`

### Method Detail

#### getTrailersProducer

    public Http2DataStreamSinkChannel.TrailersProducer getTrailersProducer()

#### setTrailersProducer

    public void setTrailersProducer(Http2DataStreamSinkChannel.TrailersProducer trailersProducer)

#### createFrameHeaderImpl

    protected SendFrameHeader createFrameHeaderImpl()

Specified by:
  `createFrameHeaderImpl` in class `Http2StreamSinkChannel`

#### write

    public long write(ByteBuffer[] srcs,
                      int offset,
                      int length)
               throws IOException

Specified by:
  `write` in interface `GatheringByteChannel`
Overrides:
  `write` in class `AbstractFramedStreamSinkChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>`
Throws:
  `IOException`

#### write

    public long write(ByteBuffer[] srcs)
               throws IOException

Specified by:
  `write` in interface `GatheringByteChannel`
Overrides:
  `write` in class `AbstractFramedStreamSinkChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>`
Throws:
  `IOException`

#### write

    public int write(ByteBuffer src)
              throws IOException

Specified by:
  `write` in interface `WritableByteChannel`
Overrides:
  `write` in class `AbstractFramedStreamSinkChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>`
Throws:
  `IOException`

#### writeFinal

    public long writeFinal(ByteBuffer[] srcs,
                           int offset,
                           int length)
                    throws IOException

Specified by:
  `writeFinal` in interface `org.xnio.channels.StreamSinkChannel`
Overrides:
  `writeFinal` in class `AbstractFramedStreamSinkChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>`
Throws:
  `IOException`

#### writeFinal

    public long writeFinal(ByteBuffer[] srcs)
                    throws IOException

Specified by:
  `writeFinal` in interface `org.xnio.channels.StreamSinkChannel`
Overrides:
  `writeFinal` in class `AbstractFramedStreamSinkChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>`
Throws:
  `IOException`

#### writeFinal

    public int writeFinal(ByteBuffer src)
                   throws IOException

Specified by:
  `writeFinal` in interface `org.xnio.channels.StreamSinkChannel`
Overrides:
  `writeFinal` in class `AbstractFramedStreamSinkChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>`
Throws:
  `IOException`

#### flush

    public boolean flush()
                  throws IOException

Specified by:
  `flush` in interface `org.xnio.channels.SuspendableWriteChannel`
Overrides:
  `flush` in class `AbstractFramedStreamSinkChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>`
Throws:
  `IOException`

#### writeBeforeHeaderBlock

    protected void writeBeforeHeaderBlock(ByteBuffer buffer)

#### isFlushRequiredOnEmptyBuffer

    protected boolean isFlushRequiredOnEmptyBuffer()

Overrides:
  `isFlushRequiredOnEmptyBuffer` in class `AbstractFramedStreamSinkChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>`

#### getHeaders

    public HeaderMap getHeaders()

#### handleFlushComplete

    protected void handleFlushComplete(boolean finalFrame)

Overrides:
  `handleFlushComplete` in class `Http2StreamSinkChannel`

#### channelForciblyClosed

    protected void channelForciblyClosed()
                                  throws IOException

Description copied from class: `AbstractFramedStreamSinkChannel`
Called when a channel has been forcibly closed, and data (frames) have already been written. The action this should take is protocol dependent, e.g. for SPDY a RST_STREAM should be sent, for websockets the channel should be closed. By default this will just close the underlying channel

Overrides:
  `channelForciblyClosed` in class `Http2StreamSinkChannel`
Throws:
  `IOException`

#### getCompletionListener

    public org.xnio.ChannelListener<Http2DataStreamSinkChannel> getCompletionListener()

#### setCompletionListener

    public void setCompletionListener(org.xnio.ChannelListener<Http2DataStreamSinkChannel> completionListener)