Java.io.RandomAccessFile Invalid argument for large files on mac

I am running a program that requires random access to a very large file (approximately 151 gigabytes). I found that whenever it runs on one of the MacPro machines in the Orchard lab (for details see http://inst.eecs.berkeley.edu/cgi-bin/clients.cgi?choice=6a&string= ) a certain part of the file and is issued 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 just use 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); 

This happens in the same place for the same exact range of bytes every time, regardless of which Orchard lab computer I use.

I tested this code on DELL computers running Debian Linux and did not have this problem.

+6
java file-io large-files random-access macos
source share
1 answer

You should use the linux "dd" command to check if the file is actually being read at that location. I assume that the file is located on a network drive in the MAC lab, and if you access your copy of the file on a Dell linux workstation, you will not get this error because the DELLs are not broken.

+1
source share

All Articles