基本读写try(FileChannelchannel=FileChannel.open(Paths.get("test.txt"),StandardOpenOption.READ,StandardOpenOption.WRITE)){// 写入数据Stringdata="Hello NIO";ByteBufferbuffer=ByteBuffer.allocate(1024);buffer.put(data.getBytes())