1

我有一堆文件(假设 1'000,每个条目介于 100 万到 1000 万个条目之间),其中包含二进制格式的双精度值(之前由 DataOutputStream 转储);在 JAVA 中恢复这些双值的最有效方法是什么?

4

2 回答 2

1

内存映射 IO 和DoubleBuffer s?

于 2012-08-25T04:02:56.753 回答
-1

使用数据输入流:

  DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream("myfile.bin")));
  while(dis.available() > 0) {
      double d = dis.readDouble();
      // ... do something with the double
  }
于 2012-08-25T04:03:40.590 回答