java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.Channel, java.nio.channels.GatheringByteChannel, java.nio.channels.InterruptibleChannel, java.nio.channels.WritableByteChannel, org.xnio.channels.CloseableChannel, org.xnio.channels.Configurable, org.xnio.channels.StreamSinkChannel, org.xnio.channels.SuspendableWriteChannelAbstractAjpClientStreamSinkChannel, AbstractHttp2StreamSinkChannel, StreamSinkFrameChannelpublic abstract class AbstractFramedStreamSinkChannel<C extends AbstractFramedChannel<C,R,S>,R extends AbstractFramedStreamSourceChannel<C,R,S>,S extends AbstractFramedStreamSinkChannel<C,R,S>>
extends java.lang.Object
implements org.xnio.channels.StreamSinkChannel
Thread safety notes:
The general contract is that this channel is only to be used by a single thread at a time. The only exception to this is
during flush. A flush will only happen when readyForFlush is set, and while this bit is set the buffer
must not be modified.
| Modifier | Constructor | Description |
|---|---|---|
protected |
AbstractFramedStreamSinkChannel(C channel) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
awaitWritable() |
|
void |
awaitWritable(long l,
java.util.concurrent.TimeUnit timeUnit) |
|
protected void |
channelForciblyClosed() |
Called when a channel has been forcibly closed, and data (frames) have already been written.
|
void |
close() |
|
protected SendFrameHeader |
createFrameHeader() |
|
boolean |
flush() |
|
java.nio.ByteBuffer |
getBuffer() |
|
C |
getChannel() |
|
org.xnio.ChannelListener.Setter<? extends S> |
getCloseSetter() |
|
org.xnio.XnioIoThread |
getIoThread() |
|
<T> T |
getOption(org.xnio.Option<T> tOption) |
|
org.xnio.XnioWorker |
getWorker() |
|
org.xnio.ChannelListener.Setter<? extends S> |
getWriteSetter() |
|
org.xnio.XnioExecutor |
getWriteThread() |
|
protected void |
handleFlushComplete(boolean finalFrame) |
|
boolean |
isBroken() |
|
boolean |
isBufferFull() |
|
protected boolean |
isFinalFrameQueued() |
|
protected boolean |
isFirstDataWritten() |
|
protected boolean |
isFlushRequiredOnEmptyBuffer() |
|
protected abstract boolean |
isLastFrame() |
|
boolean |
isOpen() |
|
boolean |
isReadyForFlush() |
|
boolean |
isWriteResumed() |
|
boolean |
isWritesShutdown() |
Returns true writes have been shutdown
|
void |
markBroken() |
|
protected PooledByteBuffer |
preWriteTransform(PooledByteBuffer body) |
|
void |
resumeWrites() |
|
protected void |
resumeWritesInternal(boolean wakeup) |
|
protected boolean |
safeToSend() |
|
boolean |
send(PooledByteBuffer pooled) |
Send a buffer to this channel.
|
protected boolean |
sendInternal(PooledByteBuffer pooled) |
|
<T> T |
setOption(org.xnio.Option<T> tOption,
T t) |
|
void |
shutdownWrites() |
|
boolean |
supportsOption(org.xnio.Option<?> option) |
|
void |
suspendWrites() |
|
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 |
wakeupWrites() |
|
int |
write(java.nio.ByteBuffer src) |
|
long |
write(java.nio.ByteBuffer[] srcs) |
|
long |
write(java.nio.ByteBuffer[] srcs,
int offset,
int length) |
|
int |
writeFinal(java.nio.ByteBuffer src) |
|
long |
writeFinal(java.nio.ByteBuffer[] srcs) |
|
long |
writeFinal(java.nio.ByteBuffer[] srcs,
int offset,
int length) |
protected AbstractFramedStreamSinkChannel(C channel)
public long transferFrom(java.nio.channels.FileChannel src,
long position,
long count)
throws java.io.IOException
transferFrom in interface org.xnio.channels.StreamSinkChanneljava.io.IOExceptionpublic long transferFrom(org.xnio.channels.StreamSourceChannel source,
long count,
java.nio.ByteBuffer throughBuffer)
throws java.io.IOException
transferFrom in interface org.xnio.channels.StreamSinkChanneljava.io.IOExceptionpublic void suspendWrites()
suspendWrites in interface org.xnio.channels.SuspendableWriteChannelprotected SendFrameHeader createFrameHeader() throws java.io.IOException
java.io.IOExceptionprotected PooledByteBuffer preWriteTransform(PooledByteBuffer body)
public boolean isWriteResumed()
isWriteResumed in interface org.xnio.channels.SuspendableWriteChannelpublic void wakeupWrites()
wakeupWrites in interface org.xnio.channels.SuspendableWriteChannelpublic void resumeWrites()
resumeWrites in interface org.xnio.channels.SuspendableWriteChannelprotected void resumeWritesInternal(boolean wakeup)
public void shutdownWrites()
throws java.io.IOException
shutdownWrites in interface org.xnio.channels.SuspendableWriteChanneljava.io.IOExceptionprotected boolean isFinalFrameQueued()
public void awaitWritable()
throws java.io.IOException
awaitWritable in interface org.xnio.channels.SuspendableWriteChanneljava.io.IOExceptionpublic void awaitWritable(long l,
java.util.concurrent.TimeUnit timeUnit)
throws java.io.IOException
awaitWritable in interface org.xnio.channels.SuspendableWriteChanneljava.io.IOExceptionpublic org.xnio.XnioExecutor getWriteThread()
getWriteThread in interface org.xnio.channels.SuspendableWriteChannelpublic org.xnio.ChannelListener.Setter<? extends S> getWriteSetter()
getWriteSetter in interface org.xnio.channels.StreamSinkChannelgetWriteSetter in interface org.xnio.channels.SuspendableWriteChannelpublic org.xnio.ChannelListener.Setter<? extends S> getCloseSetter()
getCloseSetter in interface org.xnio.channels.CloseableChannelgetCloseSetter in interface org.xnio.channels.StreamSinkChannelgetCloseSetter in interface org.xnio.channels.SuspendableWriteChannelpublic org.xnio.XnioWorker getWorker()
getWorker in interface org.xnio.channels.CloseableChannelpublic org.xnio.XnioIoThread getIoThread()
getIoThread in interface org.xnio.channels.CloseableChannelpublic boolean flush()
throws java.io.IOException
flush in interface org.xnio.channels.SuspendableWriteChanneljava.io.IOExceptionprotected boolean isFlushRequiredOnEmptyBuffer()
public long write(java.nio.ByteBuffer[] srcs,
int offset,
int length)
throws java.io.IOException
write in interface java.nio.channels.GatheringByteChanneljava.io.IOExceptionpublic long write(java.nio.ByteBuffer[] srcs)
throws java.io.IOException
write in interface java.nio.channels.GatheringByteChanneljava.io.IOExceptionpublic int write(java.nio.ByteBuffer src)
throws java.io.IOException
write in interface java.nio.channels.WritableByteChanneljava.io.IOExceptionpublic boolean send(PooledByteBuffer pooled) throws java.io.IOException
pooled - Pooled ByteBuffer to send. The buffer should have data available. This channel will free the buffer
after sending datajava.io.IOException - if this channel is closedprotected boolean sendInternal(PooledByteBuffer pooled) throws java.io.IOException
java.io.IOExceptionprotected boolean safeToSend()
throws java.io.IOException
java.io.IOExceptionpublic long writeFinal(java.nio.ByteBuffer[] srcs,
int offset,
int length)
throws java.io.IOException
writeFinal in interface org.xnio.channels.StreamSinkChanneljava.io.IOExceptionpublic long writeFinal(java.nio.ByteBuffer[] srcs)
throws java.io.IOException
writeFinal in interface org.xnio.channels.StreamSinkChanneljava.io.IOExceptionpublic int writeFinal(java.nio.ByteBuffer src)
throws java.io.IOException
writeFinal in interface org.xnio.channels.StreamSinkChanneljava.io.IOExceptionprotected abstract boolean isLastFrame()
true If this is the last frame that will be sent on this connectionpublic boolean isReadyForFlush()
public boolean isWritesShutdown()
public boolean isOpen()
isOpen in interface java.nio.channels.ChannelisOpen in interface org.xnio.channels.SuspendableWriteChannelpublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channelclose in interface java.io.Closeableclose in interface org.xnio.channels.CloseableChannelclose in interface java.nio.channels.InterruptibleChannelclose in interface org.xnio.channels.SuspendableWriteChanneljava.io.IOExceptionprotected void channelForciblyClosed()
throws java.io.IOException
java.io.IOExceptionpublic boolean supportsOption(org.xnio.Option<?> option)
supportsOption in interface org.xnio.channels.Configurablepublic <T> T getOption(org.xnio.Option<T> tOption)
throws java.io.IOException
getOption in interface org.xnio.channels.Configurablejava.io.IOExceptionpublic <T> T setOption(org.xnio.Option<T> tOption,
T t)
throws java.lang.IllegalArgumentException,
java.io.IOException
setOption in interface org.xnio.channels.Configurablejava.lang.IllegalArgumentExceptionjava.io.IOExceptionpublic java.nio.ByteBuffer getBuffer()
protected void handleFlushComplete(boolean finalFrame)
protected boolean isFirstDataWritten()
public void markBroken()
public C getChannel()
public boolean isBroken()
public boolean isBufferFull()
Copyright © 2018. All rights reserved.