Package 

Interface WritableByteChannel

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable , org.readium.r2.shared.util.zip.jvm.Channel

    
    public interface WritableByteChannel
     implements Channel
                        

    A {@code WritableByteChannel} is a type of 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.

    • Method Summary

      Modifier and Type Method Description
      abstract int write(ByteBuffer buffer) Writes bytes from the given buffer to the channel.
      • Methods inherited from class org.readium.r2.shared.util.zip.jvm.Channel

        close, isOpen
      • Methods inherited from class java.io.Closeable

        close
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • write

         abstract int write(ByteBuffer buffer)

        Writes bytes from the given buffer to the channel.

        The maximum number of bytes that will be written is theremaining() number of bytes in the buffer when the methodinvoked. The bytes will be written from the buffer starting at thebuffer's position.

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

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

        Parameters:
        buffer - the byte buffer containing the bytes to be written.