第一種反式是調(diào)用 AsynchronousFileChannel 的 read() 方法,該方法反回一個(gè) Future 類型的對(duì)象。 Future operation = fileChannelread(buffer, 0); 第一個(gè)參數(shù)是ByteBuffer,從 AsynchronousFileChannel 中讀取的數(shù)據(jù)先寫入這個(gè) ByteBuffer 。 第二個(gè)參數(shù)表示從文件讀取數(shù)據(jù)的開始位置。 此read() 方法會(huì)立即返回,即使整...
www.dbjr.com.cn/article/1944...htm 2025-5-29