
public class BlockingWritableByteChannel
extends java.lang.Object
implements java.nio.channels.GatheringByteChannel, java.io.Flushable
StreamChannel. Write operations will block until some data may be transferred.
Once any amount of data is written, the operation will return.| Constructor and Description |
|---|
BlockingWritableByteChannel(StreamSinkChannel delegate)
Construct a new instance.
|
BlockingWritableByteChannel(StreamSinkChannel delegate,
long writeTimeout,
java.util.concurrent.TimeUnit writeTimeoutUnit)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
boolean |
isOpen() |
void |
setWriteTimeout(long writeTimeout,
java.util.concurrent.TimeUnit writeTimeoutUnit)
Set the write timeout.
|
int |
write(java.nio.ByteBuffer src)
Perform a blocking write operation.
|
long |
write(java.nio.ByteBuffer[] srcs)
Perform a blocking, gathering write operation.
|
long |
write(java.nio.ByteBuffer[] srcs,
int offset,
int length)
Perform a blocking, gathering write operation.
|
public BlockingWritableByteChannel(StreamSinkChannel delegate)
delegate - the channel to forward I/O operations topublic BlockingWritableByteChannel(StreamSinkChannel delegate, long writeTimeout, java.util.concurrent.TimeUnit writeTimeoutUnit)
delegate - the channel to forward I/O operations towriteTimeout - the write timeoutwriteTimeoutUnit - the write timeout unitpublic void setWriteTimeout(long writeTimeout,
java.util.concurrent.TimeUnit writeTimeoutUnit)
writeTimeout - the write timeoutwriteTimeoutUnit - the write timeout unitpublic long write(java.nio.ByteBuffer[] srcs,
int offset,
int length)
throws java.io.IOException
write in interface java.nio.channels.GatheringByteChannelsrcs - the source buffersoffset - the offset into the destination buffer arraylength - the number of buffers to write fromjava.io.IOException - if an I/O error occurspublic long write(java.nio.ByteBuffer[] srcs)
throws java.io.IOException
write in interface java.nio.channels.GatheringByteChannelsrcs - the source buffersjava.io.IOException - if an I/O error occurspublic int write(java.nio.ByteBuffer src)
throws java.io.IOException
write in interface java.nio.channels.WritableByteChannelsrc - the source bufferjava.io.IOException - if an I/O error occurspublic boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushablejava.io.IOExceptionpublic 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.