インタフェース
java.nio.channels.CompletionHandlerの使用

CompletionHandlerを使用しているパッケージ 
パッケージ 説明
java.nio.channels
入出力操作を実行できるエンティティ(ファイル、ソケットなど)への接続を表すチャネルや、多重化された非ブロック入出力操作用のセレクタを定義します。
  • java.nio.channelsでのCompletionHandlerの使用

    CompletionHandler型のパラメータを持つjava.nio.channelsのメソッド 
    修飾子と型 メソッド 説明
    abstract <A> void AsynchronousServerSocketChannel.accept​(A attachment, CompletionHandler<AsynchronousSocketChannel,​? super A> handler)
    接続を受け入れます。
    abstract <A> void AsynchronousSocketChannel.connect​(SocketAddress remote, A attachment, CompletionHandler<Void,​? super A> handler)
    このチャネルを接続します。
    abstract <A> void AsynchronousFileChannel.lock​(long position, long size, boolean shared, A attachment, CompletionHandler<FileLock,​? super A> handler)
    このチャネルのファイルの指定された領域をロックします。
    <A> void AsynchronousFileChannel.lock​(A attachment, CompletionHandler<FileLock,​? super A> handler)
    このチャネルのファイル上に排他ロックを設定します。
    <A> void AsynchronousByteChannel.read​(ByteBuffer dst, A attachment, CompletionHandler<Integer,​? super A> handler)
    このチャネルのバイト・シーケンスを指定のバッファに読み込みます。
    abstract <A> void AsynchronousFileChannel.read​(ByteBuffer dst, long position, A attachment, CompletionHandler<Integer,​? super A> handler)
    このチャネルのバイト・シーケンスを、指定されたファイル位置からバッファに読み込みます。
    abstract <A> void AsynchronousSocketChannel.read​(ByteBuffer[] dsts, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,​? super A> handler)
    このチャネルのバイト・シーケンスを指定されたバッファのサブシーケンスに読み込みます。
    abstract <A> void AsynchronousSocketChannel.read​(ByteBuffer dst, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer,​? super A> handler)
    このチャネルのバイト・シーケンスを指定のバッファに読み込みます。
    <A> void AsynchronousSocketChannel.read​(ByteBuffer dst, A attachment, CompletionHandler<Integer,​? super A> handler)  
    <A> void AsynchronousByteChannel.write​(ByteBuffer src, A attachment, CompletionHandler<Integer,​? super A> handler)
    このチャネルのバイト・シーケンスを指定のバッファから書き出します。
    abstract <A> void AsynchronousFileChannel.write​(ByteBuffer src, long position, A attachment, CompletionHandler<Integer,​? super A> handler)
    指定されたバッファのバイト・シーケンスをこのチャネルの指定されたファイル位置に書き込みます。
    abstract <A> void AsynchronousSocketChannel.write​(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,​? super A> handler)
    このチャネルのバイト・シーケンスを指定されたバッファのサブシーケンスから書き出します。
    abstract <A> void AsynchronousSocketChannel.write​(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer,​? super A> handler)
    このチャネルのバイト・シーケンスを指定のバッファから書き出します。
    <A> void AsynchronousSocketChannel.write​(ByteBuffer src, A attachment, CompletionHandler<Integer,​? super A> handler)