Package 

Interface ReadableByteChannel

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

    
    public interface ReadableByteChannel
     implements Channel
                        

    A {@code ReadableByteChannel} is a type of Channel that can read bytes.

    Read operations are synchronous on a {@code ReadableByteChannel}, that is, if a read is already in progress on the channel then subsequent reads will block until the first read completes. It is undefined whether non-read operations will block.

    • Method Summary

      Modifier and Type Method Description
      abstract int read(ByteBuffer buffer) Reads bytes from the channel into the given buffer.
      • 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

      • read

         abstract int read(ByteBuffer buffer)

        Reads bytes from the channel into the given buffer.

        The maximum number of bytes that will be read is the remaining number of bytes in thebuffer when the method is invoked. The bytes will be read into the bufferstarting at the buffer's current position.

        The call may block if other threads are also attempting to read from thesame channel.

        Upon completion, the buffer's {@code position} is updated to the end ofthe bytes that were read. The buffer's limit is not changed.

        Parameters:
        buffer - the byte buffer to receive the bytes.