public abstract class StreamSinkFrameChannel extends Object implements org.xnio.channels.StreamSinkChannel
| Modifier and Type | Class and Description |
|---|---|
protected static class |
StreamSinkFrameChannel.ChannelState |
| Modifier and Type | Field and Description |
|---|---|
protected org.xnio.channels.StreamSinkChannel |
channel |
protected long |
payloadSize
The payload size
|
protected WebSocketChannel |
wsChannel |
| Modifier | Constructor and Description |
|---|---|
protected |
StreamSinkFrameChannel(org.xnio.channels.StreamSinkChannel channel,
WebSocketChannel wsChannel,
WebSocketFrameType type,
long payloadSize) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate()
Mark this channel as active
|
boolean |
areExtensionsSupported()
true if extendsions are supported for the WebSocketFrameType. |
void |
awaitWritable() |
void |
awaitWritable(long time,
TimeUnit timeUnit) |
protected long |
bytesToWrite()
Return the bytes which need to get written before the frame is complete
|
protected void |
checkClosed()
|
void |
close()
Closes the channel.
|
protected abstract ByteBuffer |
createFrameEnd()
Create the
ByteBuffer that marks the end of the frame |
protected abstract ByteBuffer |
createFrameStart()
Create the
ByteBuffer that will be written as start of the frame. |
protected void |
endFrameComplete()
Is called once the end of the frame was witten.
|
boolean |
flush() |
protected boolean |
flush0() |
protected void |
frameStartComplete()
Is called once the start of the frame was witten.
|
org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSinkChannel> |
getCloseSetter() |
org.xnio.XnioIoThread |
getIoThread() |
<T> T |
getOption(org.xnio.Option<T> option) |
long |
getPayloadSize() |
int |
getRsv()
Return the RSV for the extension.
|
protected StreamSinkFrameChannel.ChannelState |
getState() |
WebSocketFrameType |
getType()
Return the
WebSocketFrameType for which the StreamSinkFrameChannel was obtained. |
WebSocketChannel |
getWebSocketChannel() |
org.xnio.XnioWorker |
getWorker() |
org.xnio.ChannelListener.SimpleSetter<? extends StreamSinkFrameChannel> |
getWriteSetter() |
org.xnio.XnioExecutor |
getWriteThread() |
protected boolean |
isActive()
Return
true if this StreamSinkFrameChannel is currently in use. |
boolean |
isFinalFragment()
Return
true if this StreamSinkFrameChannel is the final fragement |
boolean |
isFragmentationSupported()
true if fragementation is supported for the WebSocketFrameType. |
boolean |
isOpen() |
boolean |
isWriteResumed() |
void |
resumeWrites() |
void |
setFinalFragment(boolean finalFragment)
Set if this
StreamSinkFrameChannel is the final fragement. |
<T> T |
setOption(org.xnio.Option<T> option,
T value) |
void |
setRsv(int rsv)
Set the RSV which is used for extensions.
|
void |
shutdownWrites() |
boolean |
supportsOption(org.xnio.Option<?> option) |
void |
suspendWrites() |
long |
transferFrom(FileChannel src,
long position,
long count) |
long |
transferFrom(org.xnio.channels.StreamSourceChannel source,
long count,
ByteBuffer throughBuffer) |
protected long |
transferFrom0(FileChannel src,
long position,
long count) |
void |
wakeupWrites() |
int |
write(ByteBuffer src) |
long |
write(ByteBuffer[] srcs) |
long |
write(ByteBuffer[] srcs,
int offset,
int length) |
protected long |
write0(ByteBuffer[] srcs,
int offset,
int length) |
protected final org.xnio.channels.StreamSinkChannel channel
protected final WebSocketChannel wsChannel
protected final long payloadSize
protected StreamSinkFrameChannel(org.xnio.channels.StreamSinkChannel channel,
WebSocketChannel wsChannel,
WebSocketFrameType type,
long payloadSize)
public org.xnio.ChannelListener.SimpleSetter<? extends StreamSinkFrameChannel> getWriteSetter()
getWriteSetter in interface org.xnio.channels.StreamSinkChannelgetWriteSetter in interface org.xnio.channels.SuspendableWriteChannelpublic long getPayloadSize()
public int getRsv()
public boolean isFinalFragment()
true if this StreamSinkFrameChannel is the final fragementpublic void setFinalFragment(boolean finalFragment)
StreamSinkFrameChannel is the final fragement.
This can only be set before any write or transfer operations where passed
to the wrapped StreamSinkChannel, after that an IllegalStateException will be thrown.public void setRsv(int rsv)
StreamSinkChannel, after that an IllegalStateException will be thrown.protected abstract ByteBuffer createFrameStart()
ByteBuffer that will be written as start of the frame.
ByteBuffer which will be used to start a frameprotected abstract ByteBuffer createFrameEnd()
ByteBuffer that marks the end of the frameByteBuffer that marks the end of the framepublic boolean isFragmentationSupported()
true if fragementation is supported for the WebSocketFrameType.public boolean areExtensionsSupported()
true if extendsions are supported for the WebSocketFrameType.protected void frameStartComplete()
protected void endFrameComplete()
protected boolean flush0()
throws IOException
IOExceptionprotected final void activate()
public WebSocketFrameType getType()
WebSocketFrameType for which the StreamSinkFrameChannel was obtained.public org.xnio.XnioWorker getWorker()
getWorker in interface org.xnio.channels.CloseableChannelpublic org.xnio.XnioIoThread getIoThread()
getIoThread in interface org.xnio.channels.CloseableChannelpublic final void close()
shutdownWrites() and flush()
for normal shutdowns.close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in interface InterruptibleChannelclose in interface org.xnio.channels.CloseableChannelclose in interface org.xnio.channels.SuspendableWriteChannelpublic long write(ByteBuffer[] srcs, int offset, int length) throws IOException
write in interface GatheringByteChannelIOExceptionprotected long write0(ByteBuffer[] srcs, int offset, int length) throws IOException
IOExceptionStreamSinkChannel#write(ByteBuffer[], int, int)}public final long write(ByteBuffer[] srcs) throws IOException
write in interface GatheringByteChannelIOExceptionpublic final int write(ByteBuffer src) throws IOException
write in interface WritableByteChannelIOExceptionpublic final long transferFrom(FileChannel src, long position, long count) throws IOException
transferFrom in interface org.xnio.channels.StreamSinkChannelIOExceptionprotected long transferFrom0(FileChannel src, long position, long count) throws IOException
IOExceptionStreamSinkChannel.transferFrom(FileChannel, long, long)public long transferFrom(org.xnio.channels.StreamSourceChannel source,
long count,
ByteBuffer throughBuffer)
throws IOException
transferFrom in interface org.xnio.channels.StreamSinkChannelIOExceptionpublic boolean isOpen()
public boolean supportsOption(org.xnio.Option<?> option)
supportsOption in interface org.xnio.channels.Configurablepublic <T> T getOption(org.xnio.Option<T> option)
throws IOException
getOption in interface org.xnio.channels.ConfigurableIOExceptionpublic <T> T setOption(org.xnio.Option<T> option,
T value)
throws IOException
setOption in interface org.xnio.channels.ConfigurableIOExceptionpublic org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSinkChannel> getCloseSetter()
getCloseSetter in interface org.xnio.channels.CloseableChannelgetCloseSetter in interface org.xnio.channels.StreamSinkChannelgetCloseSetter in interface org.xnio.channels.SuspendableWriteChannelpublic void suspendWrites()
suspendWrites in interface org.xnio.channels.SuspendableWriteChannelpublic void resumeWrites()
resumeWrites in interface org.xnio.channels.SuspendableWriteChannelprotected final boolean isActive()
true if this StreamSinkFrameChannel is currently in use.public boolean isWriteResumed()
isWriteResumed in interface org.xnio.channels.SuspendableWriteChannelpublic void wakeupWrites()
wakeupWrites in interface org.xnio.channels.SuspendableWriteChannelpublic void shutdownWrites()
throws IOException
shutdownWrites in interface org.xnio.channels.SuspendableWriteChannelIOExceptionpublic void awaitWritable()
throws IOException
awaitWritable in interface org.xnio.channels.SuspendableWriteChannelIOExceptionpublic void awaitWritable(long time,
TimeUnit timeUnit)
throws IOException
awaitWritable in interface org.xnio.channels.SuspendableWriteChannelIOExceptionprotected StreamSinkFrameChannel.ChannelState getState()
public org.xnio.XnioExecutor getWriteThread()
getWriteThread in interface org.xnio.channels.SuspendableWriteChannelpublic final boolean flush()
throws IOException
flush in interface org.xnio.channels.SuspendableWriteChannelIOExceptionprotected final long bytesToWrite()
protected final void checkClosed()
throws IOException
IOExceptionpublic WebSocketChannel getWebSocketChannel()
Copyright © 2013 JBoss by Red Hat. All Rights Reserved.