// Scattering reads分散过程
ByteBuffer buffer1 = ByteBuffer.allocate(1024);
ByteBuffer buffer2 = ByteBuffer.allocate(1024);
ByteBuffer[] bufferArray1 = { buffer1, buffer2 };
FileChannel channel1 = new FileInputStream("/testfile1").getChannel();
channel1.read(bufferArray1);
// Gathering writes聚集过程
ByteBuffer buffer3 = ByteBuffer.allocate(1024);
ByteBuffer buffer4 = ByteBuffer.allocate(1024);
ByteBuffer[] bufferArray2 = { buffer1, buffer2 };
FileChannel channel2 = new FileInputStream("/testfile1").getChannel();
channel2.write(bufferArray2);