为了加快读写操作,想用内存映射文件写文件
s是一个很大的字符串
public static void write(String s) throws IOException {
    File f = new File("1.txt");
    f.createNewFile();
    FileChannel fc = new RandomAccessFile(f, "rw").getChannel();
    CharBuffer cb = fc.map(FileChannel.MapMode.READ_WRITE, 0, 
                     s.length() * 2).asCharBuffer();
    cb.put(s);
    fc.close();
}
但是这样s中的中文却变成乱码,如何解决???
怎么样写的又快又没有乱码呢????