我有一个存储二进制的.dat文件,想把.dat文件里的内容读出来。
按理说读出的应该是中文,可是读出后是乱码,该怎么解决啊?各位大师帮帮我啊!下面是我写的,不知道转码的时候是不是有问题...思考中
File file = new File("200852111223.dat");RandomAccessFile rf = new RandomAccessFile(file, "r");
int byteLen = (int) rf.length();
byteData = new byte[byteLen];while (rf.getFilePointer() < rf.length()) {
    rf.read(byteData);
}rf.close();System.out.println(new String(result, "gb2312"));