Question

I'm trying to read a file, from a certain point in the file for a certain number of bytes.

RandomAccessFile randomAccessFile = new RandomAccessFile(_file, "r"); randomAccessFile.seek(_offSet);
randomAccessFile.read(buffer, 0, _size);

Where the _offSet and _size type is "long".

The problem is, read method only takes "int". I overcame the offset problem by using "seek", how do I overcome the amount of bytes to read?

Was it helpful?

Solution

There is no advantage I can see in trying to read more than 2 GB at once (other than simplicity) You can read more than 2 GB using multiple calls.

OTHER TIPS

Where would you read them into? You can't declare an array that big anyway. Your problem doesn't exist.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top