0

我正在使用RandomAccessFile. 我已经在我的文件中写下了我想写的所有内容,但我无法读取和打印我的文件的一组字节作为字符串。有人可以帮助我吗?

4

1 回答 1

3
RandomAccessFile rand = ... // Your RandomAccessFile instance.

rand.seek(0);

for (long i = 0; i < rand.length(); i++) 
{
    byte b = rand.readByte();
    System.out.print((char)b);
}
于 2012-11-29T06:39:36.447 回答