
public class BlockingReadableByteChannel
extends java.lang.Object
implements java.nio.channels.ScatteringByteChannel
StreamSourceChannel. Read operations will block until some data may be transferred.
Once any amount of data is read, the operation will return. If a read timeout is specified, then the read methods
will return a 0 if the timeout has elapsed without any data transfer.| Constructor and Description |
|---|
BlockingReadableByteChannel(StreamSourceChannel delegate)
Construct a new instance.
|
BlockingReadableByteChannel(StreamSourceChannel delegate,
long readTimeout,
java.util.concurrent.TimeUnit readTimeoutUnit)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
isOpen() |
int |
read(java.nio.ByteBuffer dst)
Perform a blocking read operation.
|
long |
read(java.nio.ByteBuffer[] dsts)
Perform a blocking, scattering read operation.
|
long |
read(java.nio.ByteBuffer[] dsts,
int offset,
int length)
Perform a blocking, scattering read operation.
|
void |
setReadTimeout(long readTimeout,
java.util.concurrent.TimeUnit readTimeoutUnit)
Set the read timeout.
|
public BlockingReadableByteChannel(StreamSourceChannel delegate)
delegate - the channel to forward I/O operations topublic BlockingReadableByteChannel(StreamSourceChannel delegate, long readTimeout, java.util.concurrent.TimeUnit readTimeoutUnit)
delegate - the channel to forward I/O operations toreadTimeout - the read timeoutreadTimeoutUnit - the read timeout unitpublic void setReadTimeout(long readTimeout,
java.util.concurrent.TimeUnit readTimeoutUnit)
readTimeout - the read timeoutreadTimeoutUnit - the read timeout unitpublic long read(java.nio.ByteBuffer[] dsts,
int offset,
int length)
throws java.io.IOException
read in interface java.nio.channels.ScatteringByteChanneldsts - the destination buffersoffset - the offset into the destination buffer arraylength - the number of buffers to read intojava.io.IOException - if an I/O error occurspublic long read(java.nio.ByteBuffer[] dsts)
throws java.io.IOException
read in interface java.nio.channels.ScatteringByteChanneldsts - the destination buffersjava.io.IOException - if an I/O error occurspublic int read(java.nio.ByteBuffer dst)
throws java.io.IOException
read in interface java.nio.channels.ReadableByteChanneldst - the destination bufferjava.io.IOException - if an I/O error occurspublic boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channeljava.io.IOExceptionCopyright © 2010 JBoss, a division of Red Hat, Inc.