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.StreamSinkChannel
getWriteSetter
in interface org.xnio.channels.SuspendableWriteChannel
public 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
IOException
protected final void activate()
public WebSocketFrameType getType()
WebSocketFrameType
for which the StreamSinkFrameChannel
was obtained.public org.xnio.XnioWorker getWorker()
getWorker
in interface org.xnio.channels.CloseableChannel
public org.xnio.XnioIoThread getIoThread()
getIoThread
in interface org.xnio.channels.CloseableChannel
public final void close()
shutdownWrites()
and flush()
for normal shutdowns.close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in interface InterruptibleChannel
close
in interface org.xnio.channels.CloseableChannel
close
in interface org.xnio.channels.SuspendableWriteChannel
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException
write
in interface GatheringByteChannel
IOException
protected long write0(ByteBuffer[] srcs, int offset, int length) throws IOException
IOException
StreamSinkChannel#write(ByteBuffer[], int, int)}
public final long write(ByteBuffer[] srcs) throws IOException
write
in interface GatheringByteChannel
IOException
public final int write(ByteBuffer src) throws IOException
write
in interface WritableByteChannel
IOException
public final long transferFrom(FileChannel src, long position, long count) throws IOException
transferFrom
in interface org.xnio.channels.StreamSinkChannel
IOException
protected long transferFrom0(FileChannel src, long position, long count) throws IOException
IOException
StreamSinkChannel.transferFrom(FileChannel, long, long)
public long transferFrom(org.xnio.channels.StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException
transferFrom
in interface org.xnio.channels.StreamSinkChannel
IOException
public boolean isOpen()
public boolean supportsOption(org.xnio.Option<?> option)
supportsOption
in interface org.xnio.channels.Configurable
public <T> T getOption(org.xnio.Option<T> option) throws IOException
getOption
in interface org.xnio.channels.Configurable
IOException
public <T> T setOption(org.xnio.Option<T> option, T value) throws IOException
setOption
in interface org.xnio.channels.Configurable
IOException
public org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSinkChannel> getCloseSetter()
getCloseSetter
in interface org.xnio.channels.CloseableChannel
getCloseSetter
in interface org.xnio.channels.StreamSinkChannel
getCloseSetter
in interface org.xnio.channels.SuspendableWriteChannel
public void suspendWrites()
suspendWrites
in interface org.xnio.channels.SuspendableWriteChannel
public void resumeWrites()
resumeWrites
in interface org.xnio.channels.SuspendableWriteChannel
protected final boolean isActive()
true
if this StreamSinkFrameChannel
is currently in use.public boolean isWriteResumed()
isWriteResumed
in interface org.xnio.channels.SuspendableWriteChannel
public void wakeupWrites()
wakeupWrites
in interface org.xnio.channels.SuspendableWriteChannel
public void shutdownWrites() throws IOException
shutdownWrites
in interface org.xnio.channels.SuspendableWriteChannel
IOException
public void awaitWritable() throws IOException
awaitWritable
in interface org.xnio.channels.SuspendableWriteChannel
IOException
public void awaitWritable(long time, TimeUnit timeUnit) throws IOException
awaitWritable
in interface org.xnio.channels.SuspendableWriteChannel
IOException
protected StreamSinkFrameChannel.ChannelState getState()
public org.xnio.XnioExecutor getWriteThread()
getWriteThread
in interface org.xnio.channels.SuspendableWriteChannel
public final boolean flush() throws IOException
flush
in interface org.xnio.channels.SuspendableWriteChannel
IOException
protected final long bytesToWrite()
protected final void checkClosed() throws IOException
IOException
public WebSocketChannel getWebSocketChannel()
Copyright © 2013 JBoss by Red Hat. All rights reserved.