Top Description Fields Constructors Methods
org.xnio.conduits

public final Class FramingMessageSourceConduit

extends AbstractSourceConduit<StreamSourceConduit>
implements MessageSourceConduit
Class Inheritance
All Implemented Interfaces
org.xnio.conduits.MessageSourceConduit, org.xnio.conduits.SourceConduit, org.xnio.conduits.Conduit
Static Imports
org.xnio._private.Messages.msg

A message source conduit which implements a simple message framing protocol over a stream conduit.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private boolean
private final Pooled<ByteBuffer>
receiveBuffer

References Deprecated Pooled is deprecated or references (maybe indirectly) at least one deprecated element.

Constructor Summary

AccessConstructor and Description
public
FramingMessageSourceConduit(final StreamSourceConduit
the delegate conduit to set
next
,
final Pooled<ByteBuffer>
the transmit buffer to use
receiveBuffer
)
References Deprecated Pooled is deprecated or references (maybe indirectly) at least one deprecated element.

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
awaitReadable(final long
the time to wait
time
,
final TimeUnit
the time unit
timeUnit
)

Overrides org.xnio.conduits.AbstractSourceConduit.awaitReadable.

Implements org.xnio.conduits.SourceConduit.awaitReadable.

Block until this conduit becomes readable again, or until the timeout expires.

public void
awaitReadable()

Overrides org.xnio.conduits.AbstractSourceConduit.awaitReadable.

Implements org.xnio.conduits.SourceConduit.awaitReadable.

Block until this channel becomes readable again.

public int
receive(final ByteBuffer
the buffer that will hold the message
dst
)

Implements org.xnio.conduits.MessageSourceConduit.receive.

Receive a message.

public long
receive(final ByteBuffer[]
the buffers that will hold the message
dsts
,
final int
the offset into the array of buffers of the first buffer to read into
offs
,
final int
the number of buffers to fill
len
)

Implements org.xnio.conduits.MessageSourceConduit.receive.

Receive a message.

public void
resumeReads()

Overrides org.xnio.conduits.AbstractSourceConduit.resumeReads.

Implements org.xnio.conduits.SourceConduit.resumeReads.

Indicate that the conduit's ReadReadyHandler should be invoked as soon as data can be read without blocking.

public void
terminateReads()

Overrides org.xnio.conduits.AbstractSourceConduit.terminateReads.

Implements org.xnio.conduits.SourceConduit.terminateReads.

Indicate that no more data will be read from this conduit.

Inherited from org.xnio.conduits.AbstractSourceConduit:
getReadThreadisReadResumedisReadShutdownsetReadReadyHandlersuspendReadswakeupReads

Field Detail

readyback to summary
private boolean ready
receiveBufferback to summary
private final Pooled<ByteBuffer> receiveBuffer

References Deprecated

Pooled is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Constructor Detail

FramingMessageSourceConduitback to summary
public FramingMessageSourceConduit(final StreamSourceConduit next, final Pooled<ByteBuffer> receiveBuffer)

References Deprecated

Pooled is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Construct a new instance.

Parameters
next:StreamSourceConduit

the delegate conduit to set

receiveBuffer:Pooled<ByteBuffer>

the transmit buffer to use

Method Detail

awaitReadableback to summary
public void awaitReadable(final long time, final TimeUnit timeUnit) throws IOException

Overrides org.xnio.conduits.AbstractSourceConduit.awaitReadable.

Implements org.xnio.conduits.SourceConduit.awaitReadable.

Doc from org.xnio.conduits.SourceConduit.awaitReadable.

Block until this conduit becomes readable again, or until the timeout expires. This method may return spuriously before the conduit becomes readable or the timeout expires.

Parameters
time:long

the time to wait

timeUnit:TimeUnit

the time unit

Exceptions
IOException:
if an I/O error occurs
awaitReadableback to summary
public void awaitReadable() throws IOException

Overrides org.xnio.conduits.AbstractSourceConduit.awaitReadable.

Implements org.xnio.conduits.SourceConduit.awaitReadable.

Doc from org.xnio.conduits.SourceConduit.awaitReadable.

Block until this channel becomes readable again. This method may return spuriously before the channel becomes readable.

Exceptions
IOException:
if an I/O error occurs
receiveback to summary
public int receive(final ByteBuffer dst) throws IOException

Implements org.xnio.conduits.MessageSourceConduit.receive.

Doc from org.xnio.conduits.MessageSourceConduit.receive.

Receive a message.

Parameters
dst:ByteBuffer

the buffer that will hold the message

Returns:int

the size of the received message, 0 if no message is available, and -1 if the message channel has reached an end-of-file condition

Exceptions
IOException:
if an I/O error occurs
receiveback to summary
public long receive(final ByteBuffer[] dsts, final int offs, final int len) throws IOException

Implements org.xnio.conduits.MessageSourceConduit.receive.

Doc from org.xnio.conduits.MessageSourceConduit.receive.

Receive a message.

Parameters
dsts:ByteBuffer[]

the buffers that will hold the message

offs:int

the offset into the array of buffers of the first buffer to read into

len:int

the number of buffers to fill

Returns:long

the size of the received message, 0 if no message is available, and -1 if the message channel has reached an end-of-file condition

Exceptions
IOException:
if an I/O error occurs
resumeReadsback to summary
public void resumeReads()

Overrides org.xnio.conduits.AbstractSourceConduit.resumeReads.

Implements org.xnio.conduits.SourceConduit.resumeReads.

Doc from org.xnio.conduits.SourceConduit.resumeReads.

Indicate that the conduit's ReadReadyHandler should be invoked as soon as data can be read without blocking.

terminateReadsback to summary
public void terminateReads() throws IOException

Overrides org.xnio.conduits.AbstractSourceConduit.terminateReads.

Implements org.xnio.conduits.SourceConduit.terminateReads.

Doc from org.xnio.conduits.SourceConduit.terminateReads.

Indicate that no more data will be read from this conduit. If unread data exists, an exception may be thrown.

Exceptions
IOException:
if there was a problem