Top Description Inners Fields Constructors Methods
org.xnio.channels

public final Class PushBackStreamChannel

extends Object
implements StreamSourceChannel, WrappedChannel<StreamSourceChannel>
Class Inheritance
All Implemented Interfaces
org.xnio.channels.WrappedChannel, org.xnio.channels.StreamSourceChannel, org.xnio.channels.SuspendableReadChannel, org.xnio.channels.CloseableChannel, org.xnio.channels.Configurable, java.nio.channels.InterruptibleChannel, java.nio.channels.Channel, java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.ScatteringByteChannel, java.nio.channels.ReadableByteChannel
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.FileChannel, java.util.concurrent.TimeUnit, org.xnio.Buffers, .ChannelListener, .ChannelListeners, .Option, .Pooled, .XnioExecutor, .XnioIoThread, .XnioWorker

A stream source channel which can have data pushed back into it. Note that waiting readers will NOT be interrupted when data is pushed back; therefore data should only be pushed back at points when no waiters are expected to exist.
Author
David M. Lloyd

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private StreamSourceChannel
private ChannelListener<? super PushBackStreamChannel>
private final StreamSourceChannel
private ChannelListener<? super PushBackStreamChannel>

Constructor Summary

AccessConstructor and Description
public
PushBackStreamChannel(final StreamSourceChannel
the channel to wrap
channel
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
awaitReadable()

Implements org.xnio.channels.SuspendableReadChannel.awaitReadable.

Block until this channel becomes readable again.

public void
awaitReadable(final long
the time to wait
time
,
final TimeUnit
the time unit
timeUnit
)

Implements org.xnio.channels.SuspendableReadChannel.awaitReadable.

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

public void
public StreamSourceChannel
getChannel()

Implements org.xnio.channels.WrappedChannel.getChannel.

Get the channel which is wrapped by this object.

public ChannelListener.Setter<? extends PushBackStreamChannel>
getCloseSetter()

Implements org.xnio.channels.StreamSourceChannel.getCloseSetter.

Get the setter which can be used to change the close listener for this channel.

public XnioIoThread
getIoThread()

Implements org.xnio.channels.CloseableChannel.getIoThread.

Get the I/O thread associated with this channel.

public <T> T
getOption(final Option<T>
the option to get
option
)

Implements org.xnio.channels.Configurable.getOption.

Get the value of a channel option.

public ChannelListener.Setter<? extends PushBackStreamChannel>
getReadSetter()

Implements org.xnio.channels.StreamSourceChannel.getReadSetter.

Get the setter which can be used to change the read listener for this channel.

public XnioExecutor
getReadThread()

Implements org.xnio.channels.SuspendableReadChannel.getReadThread.

Deprecated

Get the read thread for this channel.

public XnioWorker
getWorker()

Implements org.xnio.channels.CloseableChannel.getWorker.

Get the worker for this channel.

public boolean
isOpen()

Implements java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

public boolean
isReadResumed()

Implements org.xnio.channels.SuspendableReadChannel.isReadResumed.

Determine whether reads are resumed.

public int
read(final ByteBuffer
The buffer into which bytes are to be transferred
dst
)

Implements java.nio.channels.ReadableByteChannel.read.

Reads a sequence of bytes from this channel into the given buffer.

public long
read(final ByteBuffer[]
The buffers into which bytes are to be transferred
dsts
)

Implements java.nio.channels.ScatteringByteChannel.read.

Reads a sequence of bytes from this channel into the given buffers.

public long
read(final ByteBuffer[]
The buffers into which bytes are to be transferred
dsts
,
final int
The offset within the buffer array of the first buffer into which bytes are to be transferred; must be non-negative and no larger than dsts.length
offset
,
final int
The maximum number of buffers to be accessed; must be non-negative and no larger than dsts.length - offset
length
)

Implements java.nio.channels.ScatteringByteChannel.read.

Reads a sequence of bytes from this channel into a subsequence of the given buffers.

public void
resumeReads()

Implements org.xnio.channels.SuspendableReadChannel.resumeReads.

Resume reads on this channel.

public void
public <T> T
setOption(final Option<T>
the option to set
option
,
final T
the value of the option to set
value
)

Implements org.xnio.channels.Configurable.setOption.

Set an option for this channel.

public void
public void
shutdownReads()

Implements org.xnio.channels.SuspendableReadChannel.shutdownReads.

Places this readable channel at "end of stream".

public boolean
supportsOption(final Option<?>
the option
option
)

Implements org.xnio.channels.Configurable.supportsOption.

Determine whether an option is supported on this channel.

public void
suspendReads()

Implements org.xnio.channels.SuspendableReadChannel.suspendReads.

Suspend further read notifications on this channel.

public long
transferTo(final long
the position within the file from which the transfer is to begin
position
,
final long
the number of bytes to be transferred
count
,
final FileChannel
the file to write to
target
)

Implements org.xnio.channels.StreamSourceChannel.transferTo.

Transfers bytes into the given file from this channel.

public long
transferTo(final long
the number of bytes to be transferred
count
,
final ByteBuffer
the buffer to copy through.
throughBuffer
,
final StreamSinkChannel
the destination to write to
target
)

Implements org.xnio.channels.StreamSourceChannel.transferTo.

Transfers bytes into the given channel target.

public void
unget(Pooled<ByteBuffer>
the buffer to re-queue
buffer
)
References Deprecated Pooled is deprecated or references (maybe indirectly) at least one deprecated element.

Re-queue the given pooled buffer into this channel.

public void
wakeupReads()

Implements org.xnio.channels.SuspendableReadChannel.wakeupReads.

Resume reads on this channel, and force the read listener to be triggered even if the channel isn't actually readable.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait