你要先用long getPointer = rafo.getFilePointer();取得文件的大小
然后再根据这个值调整 rafo= new RandomAccessFile( "aaa.txt", "rw");
long getPointer = rafo.getFilePointer();
rafo.setLength(getPointer);
fc= rafo.getChannel();
MappedByteBuffer mbb = fc.map( FileChannel.MapMode.READ_WRITE, 0L , fc.size());
return mbb;
然后再根据这个值调整 rafo= new RandomAccessFile( "aaa.txt", "rw");
long getPointer = rafo.getFilePointer();
rafo.setLength(getPointer);
fc= rafo.getChannel();
MappedByteBuffer mbb = fc.map( FileChannel.MapMode.READ_WRITE, 0L , fc.size());
return mbb;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货