java.io.RandomAccessFile 对于 Mac 上的大文件无效参数

发布于 2024-10-06 18:54:34 字数 889 浏览 7 评论 0原文

我正在运行一个程序,需要随机访问一个非常大的文件(大约 151 GB)。我发现每当它在 Orchard 实验室的一台 MacPro 机器上运行时(详细信息请参见 http://inst.eecs.berkeley.edu/cgi-bin/clients.cgi?choice=6a&string= ),程序尝试读取的特定部分文件并因文件系统错误而崩溃:

java.io.IOException: Invalid argument
    at java.io.RandomAccessFile.readBytes(Native Method)
    at java.io.RandomAccessFile.read(RandomAccessFile.java:322)

我只是使用 RandomAccessFile 类。

RandomAccessFile fd;
//...Initialized and already used fd with
//no problems for larger locations as well
//location == 155587178230
//numBytes == 15492560
//off == 0
//arr.length == 15492560
fd.seek(location);
fd.read(arr, off, numBytes);

无论我使用哪一台 Orchard 实验室计算机,它每次都会在相同的确切位置、相同的字节范围内发生。

我已经在运行 Debian Linux 的 DELL 计算机上测试了此代码,并且没有遇到此问题。

I'm running a program which needs random access to a very large file (approximately 151 gigabytes). I've found that whenever it runs on one of the MacPro machines in the Orchard lab ( details at http://inst.eecs.berkeley.edu/cgi-bin/clients.cgi?choice=6a&string= ), the program tries to read a specific part of the file and crashes with an error from the file system:

java.io.IOException: Invalid argument
    at java.io.RandomAccessFile.readBytes(Native Method)
    at java.io.RandomAccessFile.read(RandomAccessFile.java:322)

I'm just using the RandomAccessFile class.

RandomAccessFile fd;
//...Initialized and already used fd with
//no problems for larger locations as well
//location == 155587178230
//numBytes == 15492560
//off == 0
//arr.length == 15492560
fd.seek(location);
fd.read(arr, off, numBytes);

It happens in the same exact place for the same exact range of bytes every time no matter which of the Orchard lab computers I use.

I've tested this code on DELL computers running Debian Linux and not had this problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紫南 2024-10-13 18:54:34

您应该使用 Linux 命令“dd”来检查文件在给定位置是否确实可读。我假设该文件位于 MAC 实验室的网络驱动器上,如果您在 Dell Linux 工作站上访问该文件的副本,则不会收到此错误,因为 DELL 磁盘没有损坏。

You should use the linux command "dd" to check if the file is really readable at the given location. I assume the file is on a network drive in the MAC lab, and if you access your copy of the file on the Dell linux workstation you won't get this error because DELLs disks are not broken.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文