RandomAccessFile用  writeUTF() 写文件的时候为什么第一个字符会是乱码,请高手指点

解决方案 »

  1.   

    First, two bytes are written to the file, starting at the current file pointer, as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the UTF-8 encoding for each character.
      

  2.   

    没觉得这段英文有什么难的
    你学java难道不看api?
      

  3.   

    First, two bytes are written to the file, starting at the current file pointer, as if by the writeShort method giving the number of bytes to follow
    这给解释一下谢谢
      

  4.   

    写两个字节进去,这两个字节代表写入的字节数
    比如writeUTF("abc");
    头两个字节是0、3
      

  5.   

    不行啊
    inout.writeShort(length);
    inout.writeUTF(out);
    inout.close();
    这样写对吗