public class FramedMessageChannel extends TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel> implements ConnectedMessageChannel
TranslatingSuspendableChannel.Readinesschannel| Constructor and Description |
|---|
FramedMessageChannel(ConnectedStreamChannel channel,
ByteBuffer receiveBuffer,
ByteBuffer transmitBuffer)
Construct a new instance.
|
FramedMessageChannel(ConnectedStreamChannel channel,
Pooled<ByteBuffer> receiveBuffer,
Pooled<ByteBuffer> transmitBuffer)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Base channel close implementation.
|
boolean |
flush()
Base implementation which delegates the flush request to the channel.
|
ConnectedStreamChannel |
getChannel()
Get the underlying channel.
|
SocketAddress |
getLocalAddress()
Get the local address that this channel is bound to.
|
<A extends SocketAddress> |
getLocalAddress(Class<A> type)
Get the local address of a given type, or
null if the address is not of that
type. |
SocketAddress |
getPeerAddress()
Get the peer address of this channel.
|
<A extends SocketAddress> |
getPeerAddress(Class<A> type)
Get the peer address of a given type, or
null if the address is not of that
type. |
protected Object |
getReadLock()
Get the object to use as a read lock.
|
protected Object |
getWriteLock()
Get the object to use as a write lock.
|
protected TranslatingSuspendableChannel.Readiness |
isReadable()
Determine whether this channel is known to be (or to not be) readable.
|
protected TranslatingSuspendableChannel.Readiness |
isWritable()
Determine whether this channel is known to be (or to not be) writable.
|
int |
receive(ByteBuffer buffer)
Receive a message.
|
long |
receive(ByteBuffer[] buffers)
Receive a message.
|
long |
receive(ByteBuffer[] buffers,
int offs,
int len)
Receive a message.
|
boolean |
send(ByteBuffer buffer)
Send a complete message.
|
boolean |
send(ByteBuffer[] buffers)
Send a complete message.
|
boolean |
send(ByteBuffer[] buffers,
int offs,
int len)
Send a complete message.
|
void |
shutdownReads()
Base implementation method which simply delegates the shutdown request to the delegate channel.
|
boolean |
shutdownWrites()
Base implementation method which simply delegates the shutdown request to the delegate channel.
|
awaitReadable, awaitReadable, awaitWritable, awaitWritable, getCloseSetter, getOption, getReadSetter, getReadThread, getWorker, getWriteSetter, getWriteThread, handleReadable, handleWritable, isOpen, isReadResumed, isWriteResumed, resumeReads, resumeReadsIfRequested, resumeReadsIfRequestedAndSuspendWrites, resumeWrites, resumeWritesIfRequested, resumeWritesIfRequestedAndSuspendReads, setOption, supportsOption, suspendReads, suspendWrites, thisTyped, toString, wakeupReads, wakeupReadsIfRequested, wakeupWrites, wakeupWritesIfRequestedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCloseSetter, getReadSetter, getWriteSetterawaitReadable, awaitReadable, getReadThread, isReadResumed, resumeReads, suspendReads, wakeupReadsawaitWritable, awaitWritable, getWriteThread, isWriteResumed, resumeWrites, suspendWrites, wakeupWritesgetWorkergetOption, setOption, supportsOptionpublic FramedMessageChannel(ConnectedStreamChannel channel, ByteBuffer receiveBuffer, ByteBuffer transmitBuffer)
channel - the channel to wrapreceiveBuffer - the receive buffer (should be direct)transmitBuffer - the send buffer (should be direct)public FramedMessageChannel(ConnectedStreamChannel channel, Pooled<ByteBuffer> receiveBuffer, Pooled<ByteBuffer> transmitBuffer)
channel - the channel to wrapreceiveBuffer - the receive buffer (should be direct)transmitBuffer - the send buffer (should be direct)protected TranslatingSuspendableChannel.Readiness isReadable()
isReadable in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>protected Object getReadLock()
getReadLock in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>protected TranslatingSuspendableChannel.Readiness isWritable()
isWritable in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>protected Object getWriteLock()
getWriteLock in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>public int receive(ByteBuffer buffer) throws IOException
receive in interface ReadableMessageChannelbuffer - the buffer that will hold the messageIOException - if an I/O error occurspublic long receive(ByteBuffer[] buffers) throws IOException
receive in interface ReadableMessageChannelbuffers - the buffers that will hold the messageIOException - if an I/O error occurspublic long receive(ByteBuffer[] buffers, int offs, int len) throws IOException
receive in interface ReadableMessageChannelbuffers - the buffers that will hold the messageoffs - the offset into the array of buffers of the first buffer to read intolen - the number of buffers to fillIOException - if an I/O error occurspublic void shutdownReads()
throws IOException
shutdownReads in interface SuspendableReadChannelshutdownReads in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>IOException - if an I/O error occurspublic boolean send(ByteBuffer buffer) throws IOException
send in interface WritableMessageChannelbuffer - the message to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean send(ByteBuffer[] buffers) throws IOException
send in interface WritableMessageChannelbuffers - the buffers holding the message to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean send(ByteBuffer[] buffers, int offs, int len) throws IOException
send in interface WritableMessageChannelbuffers - the buffers holding the message to sendoffs - the offset into the buffer array of the first bufferlen - the number of buffers that contain data to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean shutdownWrites()
throws IOException
shutdownWrites in interface SuspendableWriteChannelshutdownWrites in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>true if the channel was shut down, or false if the operation would blockIOException - if an I/O error occurspublic boolean flush()
throws IOException
flush in interface SuspendableWriteChannelflush in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>true if the flush completed, or false if the operation would blockIOException - if an error occurspublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in interface InterruptibleChannelclose in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>IOException - if an I/O error occurspublic SocketAddress getPeerAddress()
getPeerAddress in interface ConnectedChannelpublic <A extends SocketAddress> A getPeerAddress(Class<A> type)
null if the address is not of that
type.getPeerAddress in interface ConnectedChanneltype - the address type classnull if unknownpublic SocketAddress getLocalAddress()
getLocalAddress in interface BoundChannelpublic <A extends SocketAddress> A getLocalAddress(Class<A> type)
null if the address is not of that
type.getLocalAddress in interface BoundChannelA - the address typetype - the address type classnull if unknownpublic ConnectedStreamChannel getChannel()
getChannel in interface WrappedChannel<ConnectedStreamChannel>getChannel in class TranslatingSuspendableChannel<ConnectedMessageChannel,ConnectedStreamChannel>Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.