你要先用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;