Class AbstractFramedStreamSourceChannel<C extends AbstractFramedChannel<C,R,S>,R extends AbstractFramedStreamSourceChannel<C,R,S>,S extends AbstractFramedStreamSinkChannel<C,R,S>>
java.lang.Object
io.undertow.server.protocol.framed.AbstractFramedStreamSourceChannel<C,R,S>
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,InterruptibleChannel,ReadableByteChannel,ScatteringByteChannel,org.xnio.channels.CloseableChannel,org.xnio.channels.Configurable,org.xnio.channels.StreamSourceChannel,org.xnio.channels.SuspendableReadChannel
- Direct Known Subclasses:
AbstractAjpClientStreamSourceChannel,AbstractHttp2StreamSourceChannel,StreamSourceFrameChannel
public abstract class AbstractFramedStreamSourceChannel<C extends AbstractFramedChannel<C,R,S>,R extends AbstractFramedStreamSourceChannel<C,R,S>,S extends AbstractFramedStreamSinkChannel<C,R,S>>
extends Object
implements org.xnio.channels.StreamSourceChannel
Source channel, used to receive framed messages.
- Author:
- Stuart Douglas, Flavia Rainone
-
Field Summary
Fields inherited from interface org.xnio.channels.Configurable
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFramedStreamSourceChannel(C framedChannel) AbstractFramedStreamSourceChannel(C framedChannel, PooledByteBuffer data, long frameDataRemaining) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloseTask(org.xnio.ChannelListener<R> channelListener) voidvoidawaitReadable(long l, TimeUnit timeUnit) protected voidvoidclose()protected voidcomplete()Method that is invoked when all data has been read.protected voiddataReady(FrameHeaderData headerData, PooledByteBuffer frameData) Called when data has been read from the underlying channel.org.xnio.ChannelListener.Setter<? extends R>protected Corg.xnio.XnioIoThreadlong<T> TgetOption(org.xnio.Option<T> tOption) protected intorg.xnio.ChannelListener.Setter<? extends R>org.xnio.XnioExecutororg.xnio.XnioWorkerprotected voidhandleHeaderData(FrameHeaderData headerData) protected booleanprotected booleanbooleanisOpen()booleanprotected voidprotected voidCalled when this stream is no longer valid.protected PooledByteBufferprocessFrameData(PooledByteBuffer data, boolean lastFragmentOfFrame) intread(ByteBuffer dst) longread(ByteBuffer[] dsts) longread(ByteBuffer[] dsts, int offset, int length) voidvoidsetMaxStreamSize(long maxStreamSize) <T> TsetOption(org.xnio.Option<T> tOption, T t) voidbooleansupportsOption(org.xnio.Option<?> option) voidlongtransferTo(long position, long count, FileChannel target) longtransferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel streamSinkChannel) protected longupdateFrameDataRemaining(PooledByteBuffer frameData, long frameDataRemaining) void
-
Constructor Details
-
AbstractFramedStreamSourceChannel
-
AbstractFramedStreamSourceChannel
public AbstractFramedStreamSourceChannel(C framedChannel, PooledByteBuffer data, long frameDataRemaining)
-
-
Method Details
-
transferTo
- Specified by:
transferToin interfaceorg.xnio.channels.StreamSourceChannel- Throws:
IOException
-
transferTo
public long transferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel streamSinkChannel) throws IOException - Specified by:
transferToin interfaceorg.xnio.channels.StreamSourceChannel- Throws:
IOException
-
getMaxStreamSize
public long getMaxStreamSize() -
setMaxStreamSize
public void setMaxStreamSize(long maxStreamSize) -
suspendReads
public void suspendReads()- Specified by:
suspendReadsin interfaceorg.xnio.channels.SuspendableReadChannel
-
complete
Method that is invoked when all data has been read.- Throws:
IOException
-
isComplete
protected boolean isComplete() -
resumeReads
public void resumeReads()- Specified by:
resumeReadsin interfaceorg.xnio.channels.SuspendableReadChannel
-
isReadResumed
public boolean isReadResumed()- Specified by:
isReadResumedin interfaceorg.xnio.channels.SuspendableReadChannel
-
wakeupReads
public void wakeupReads()- Specified by:
wakeupReadsin interfaceorg.xnio.channels.SuspendableReadChannel
-
addCloseTask
-
shutdownReads
- Specified by:
shutdownReadsin interfaceorg.xnio.channels.SuspendableReadChannel- Throws:
IOException
-
lastFrame
protected void lastFrame() -
isLastFrame
protected boolean isLastFrame() -
awaitReadable
- Specified by:
awaitReadablein interfaceorg.xnio.channels.SuspendableReadChannel- Throws:
IOException
-
awaitReadable
- Specified by:
awaitReadablein interfaceorg.xnio.channels.SuspendableReadChannel- Throws:
IOException
-
dataReady
Called when data has been read from the underlying channel.- Parameters:
headerData- The frame header data. This may be null if the data is part of a an existing frameframeData- The frame data
-
updateFrameDataRemaining
-
processFrameData
protected PooledByteBuffer processFrameData(PooledByteBuffer data, boolean lastFragmentOfFrame) throws IOException - Throws:
IOException
-
handleHeaderData
-
getReadThread
public org.xnio.XnioExecutor getReadThread()- Specified by:
getReadThreadin interfaceorg.xnio.channels.SuspendableReadChannel
-
getReadSetter
- Specified by:
getReadSetterin interfaceorg.xnio.channels.StreamSourceChannel- Specified by:
getReadSetterin interfaceorg.xnio.channels.SuspendableReadChannel
-
getCloseSetter
- Specified by:
getCloseSetterin interfaceorg.xnio.channels.CloseableChannel- Specified by:
getCloseSetterin interfaceorg.xnio.channels.StreamSourceChannel- Specified by:
getCloseSetterin interfaceorg.xnio.channels.SuspendableReadChannel
-
getWorker
public org.xnio.XnioWorker getWorker()- Specified by:
getWorkerin interfaceorg.xnio.channels.CloseableChannel
-
getIoThread
public org.xnio.XnioIoThread getIoThread()- Specified by:
getIoThreadin interfaceorg.xnio.channels.CloseableChannel
-
supportsOption
public boolean supportsOption(org.xnio.Option<?> option) - Specified by:
supportsOptionin interfaceorg.xnio.channels.Configurable
-
getOption
- Specified by:
getOptionin interfaceorg.xnio.channels.Configurable- Throws:
IOException
-
setOption
public <T> T setOption(org.xnio.Option<T> tOption, T t) throws IllegalArgumentException, IOException - Specified by:
setOptionin interfaceorg.xnio.channels.Configurable- Throws:
IllegalArgumentExceptionIOException
-
read
- Specified by:
readin interfaceScatteringByteChannel- Throws:
IOException
-
read
- Specified by:
readin interfaceScatteringByteChannel- Throws:
IOException
-
read
- Specified by:
readin interfaceReadableByteChannel- Throws:
IOException
-
isOpen
public boolean isOpen() -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.xnio.channels.CloseableChannel- Specified by:
closein interfaceInterruptibleChannel
-
channelForciblyClosed
protected void channelForciblyClosed() -
getFramedChannel
-
getReadFrameCount
protected int getReadFrameCount() -
markStreamBroken
protected void markStreamBroken()Called when this stream is no longer valid. Reads from the stream will result in an exception.
-