FileDocCategorySizeDatePackage
WritableByteChannel.javaAPI DocAndroid 1.5 API2809Wed May 06 22:41:04 BST 2009java.nio.channels

WritableByteChannel

public interface WritableByteChannel implements Channel
A {@code WritableByteChannel} is a type of {@link Channel} that can write bytes.

Write operations are synchronous on a {@code WritableByteChannel}, that is, if a write is already in progress on the channel then subsequent writes will block until the first write completes. It is undefined whether non-write operations will block.

since
Android 1.0

Fields Summary
Constructors Summary
Methods Summary
public intwrite(java.nio.ByteBuffer buffer)
Writes bytes from the given buffer to the channel.

The maximum number of bytes that will be written is the remaining() number of bytes in the buffer when the method invoked. The bytes will be written from the buffer starting at the buffer's position.

The call may block if other threads are also attempting to write on the same channel.

Upon completion, the buffer's position() is updated to the end of the bytes that were written. The buffer's limit() is unmodified.

param
buffer the byte buffer containing the bytes to be written.
return
the number of bytes actually written.
throws
NonWritableChannelException if the channel was not opened for writing.
throws
ClosedChannelException if the channel was already closed.
throws
AsynchronousCloseException if another thread closes the channel during the write.
throws
ClosedByInterruptException if another thread interrupt the calling thread during the write.
throws
IOException another IO exception occurs, details are in the message.
since
Android 1.0