Uses of Interface java.nio.channels.CompletionHandler (Java Platform SE 8 )
Date: 2026-04-22

## Uses of Interface
java.nio.channels.CompletionHandler

- Packages that use CompletionHandler
  Package | Description
  --- | ---
  java.nio.channels | Defines channels, which represent connections to entities that are capable of performing I/O operations, such as files and sockets; defines selectors, for multiplexed, non-blocking I/O operations.

- - ### Uses of CompletionHandler in java.nio.channels

    Methods in java.nio.channels with parameters of type CompletionHandler
    Modifier and Type | Method and Description
    --- | ---
    `abstract <A> void` | AsynchronousServerSocketChannel.`accept(A attachment, CompletionHandler<AsynchronousSocketChannel,? super A> handler)` Accepts a connection.
    `abstract <A> void` | AsynchronousSocketChannel.`connect(SocketAddress remote, A attachment, CompletionHandler<Void,? super A> handler)` Connects this channel.
    `<A> void` | AsynchronousFileChannel.`lock(A attachment, CompletionHandler<FileLock,? super A> handler)` Acquires an exclusive lock on this channel's file.
    `abstract <A> void` | AsynchronousFileChannel.`lock(long position, long size, boolean shared, A attachment, CompletionHandler<FileLock,? super A> handler)` Acquires a lock on the given region of this channel's file.
    `abstract <A> void` | AsynchronousSocketChannel.`read(ByteBuffer[] dsts, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,? super A> handler)` Reads a sequence of bytes from this channel into a subsequence of the given buffers.
    `<A> void` | AsynchronousSocketChannel.`read(ByteBuffer dst, A attachment, CompletionHandler<Integer,? super A> handler)`
    `<A> void` | AsynchronousByteChannel.`read(ByteBuffer dst, A attachment, CompletionHandler<Integer,? super A> handler)` Reads a sequence of bytes from this channel into the given buffer.
    `abstract <A> void` | AsynchronousFileChannel.`read(ByteBuffer dst, long position, A attachment, CompletionHandler<Integer,? super A> handler)` Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.
    `abstract <A> void` | AsynchronousSocketChannel.`read(ByteBuffer dst, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer,? super A> handler)` Reads a sequence of bytes from this channel into the given buffer.
    `abstract <A> void` | AsynchronousSocketChannel.`write(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,? super A> handler)` Writes a sequence of bytes to this channel from a subsequence of the given buffers.
    `<A> void` | AsynchronousSocketChannel.`write(ByteBuffer src, A attachment, CompletionHandler<Integer,? super A> handler)`
    `<A> void` | AsynchronousByteChannel.`write(ByteBuffer src, A attachment, CompletionHandler<Integer,? super A> handler)` Writes a sequence of bytes to this channel from the given buffer.
    `abstract <A> void` | AsynchronousFileChannel.`write(ByteBuffer src, long position, A attachment, CompletionHandler<Integer,? super A> handler)` Writes a sequence of bytes to this channel from the given buffer, starting at the given file position.
    `abstract <A> void` | AsynchronousSocketChannel.`write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer,? super A> handler)` Writes a sequence of bytes to this channel from the given buffer.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.