在输出ByteBuffer 默认未byte 对象数据,所以要转换未char 数据,
ByteBuufer 默认有一个asCharBuufer方法,但是.运用这个方法有一个前提,1输出时候解码,2输出时候解码
我选择第二种,方便一点 think of java 554
String inPath = "/home/if/test/in.text"; File file = new File(inPath); FileChannel channel = new FileInputStream(file).getChannel(); ByteBuffer buffer = ByteBuffer.allocate(BSIZE); buffer.clear(); channel.read(buffer); buffer.flip(); System.out.println(buffer.asCharBuffer());