public final class StreamSourceChannelWrappingConduit extends java.lang.Object implements StreamSourceConduit
| Constructor and Description |
|---|
StreamSourceChannelWrappingConduit(StreamSourceChannel channel)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
awaitReadable()
Block until this channel becomes readable again.
|
void |
awaitReadable(long time,
java.util.concurrent.TimeUnit timeUnit)
Block until this conduit becomes readable again, or until the timeout expires.
|
XnioIoThread |
getReadThread()
Get the XNIO read thread.
|
XnioWorker |
getWorker()
Get the XNIO worker associated with this conduit.
|
boolean |
isReadResumed()
Determine whether read notifications are currently enabled.
|
boolean |
isReadShutdown()
Determine whether reads have been shut down on this conduit.
|
int |
read(java.nio.ByteBuffer dst)
Read a sequence of bytes from this conduit to the given buffer.
|
long |
read(java.nio.ByteBuffer[] dsts,
int offs,
int len)
Read a sequence of bytes from this conduit to the given buffers.
|
void |
resumeReads()
Indicate that the conduit's
ReadReadyHandler should be invoked as soon as data can be read
without blocking. |
void |
setReadReadyHandler(ReadReadyHandler handler)
Set the handler which should receive readiness notifications.
|
void |
suspendReads()
Indicate that calling the conduit's
ReadReadyHandler should be suspended. |
void |
terminateReads()
Indicate that no more data will be read from this conduit.
|
long |
transferTo(long count,
java.nio.ByteBuffer throughBuffer,
StreamSinkChannel target)
Transfers bytes into the given channel target.
|
long |
transferTo(long position,
long count,
FileChannel target)
Transfers bytes into the given file from this channel.
|
void |
wakeupReads()
Indicate that the conduit's
ReadReadyHandler should be invoked immediately, and then again as soon
as data can be read without blocking. |
public StreamSourceChannelWrappingConduit(StreamSourceChannel channel)
channel - the channel to wrappublic void terminateReads()
throws java.io.IOException
SourceConduitterminateReads in interface SourceConduitjava.io.IOException - if there was a problempublic long transferTo(long position,
long count,
FileChannel target)
throws java.io.IOException
StreamSourceConduittransferTo in interface StreamSourceConduitposition - the position within the file from which the transfer is to begincount - the number of bytes to be transferredtarget - the file to write tojava.io.IOException - if an I/O error occurspublic long transferTo(long count,
java.nio.ByteBuffer throughBuffer,
StreamSinkChannel target)
throws java.io.IOException
StreamSourceConduitthroughBuffer will be cleared. On exit, the buffer will be
flipped for emptying, and may possibly be empty or may contain data. If this method returns a value less than
count, then the remaining data in throughBuffer may contain data read from this channel which must
be written to target to complete the operation.transferTo in interface StreamSourceConduitcount - the number of bytes to be transferredthroughBuffer - the buffer to copy through.target - the destination to write tojava.io.IOException - if an I/O error occurspublic int read(java.nio.ByteBuffer dst)
throws java.io.IOException
StreamSourceConduitread in interface StreamSourceConduitSourceConduit.terminateReads() method was previously calledjava.io.IOException - if an error occurspublic long read(java.nio.ByteBuffer[] dsts,
int offs,
int len)
throws java.io.IOException
StreamSourceConduitread in interface StreamSourceConduitoffs - the offset into the buffer arraylen - the number of buffers to fillSourceConduit.terminateReads() method was previously calledjava.io.IOException - if an error occurspublic boolean isReadShutdown()
SourceConduitisReadShutdown in interface SourceConduittrue if writes are shut down, false otherwisepublic void resumeReads()
SourceConduitReadReadyHandler should be invoked as soon as data can be read
without blocking.resumeReads in interface SourceConduitpublic void suspendReads()
SourceConduitReadReadyHandler should be suspended.suspendReads in interface SourceConduitpublic void wakeupReads()
SourceConduitReadReadyHandler should be invoked immediately, and then again as soon
as data can be read without blocking.wakeupReads in interface SourceConduitpublic boolean isReadResumed()
SourceConduitisReadResumed in interface SourceConduittrue if read notifications are enabledpublic void awaitReadable()
throws java.io.IOException
SourceConduitawaitReadable in interface SourceConduitjava.io.InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as welljava.io.IOException - if an I/O error occurspublic void awaitReadable(long time,
java.util.concurrent.TimeUnit timeUnit)
throws java.io.IOException
SourceConduitawaitReadable in interface SourceConduittime - the time to waittimeUnit - the time unitjava.io.InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as welljava.io.IOException - if an I/O error occurspublic XnioIoThread getReadThread()
SourceConduitgetReadThread in interface SourceConduitpublic void setReadReadyHandler(ReadReadyHandler handler)
SourceConduitsetReadReadyHandler in interface SourceConduitpublic XnioWorker getWorker()
ConduitCopyright © 2016 JBoss, a division of Red Hat, Inc.