开发者

Random Access files > 2GB with Android SDK

can anyone tell me how to random access a file beyond 2GB with android SDK. I was trying to seek to a position > 2147483647 and got the exception: "Value too large for defined datatype". That is odd as the parameter for the seek command is type "long". See the code example for details:

RandomAccessFile    BigFile;
BigFile = new Rando开发者_Python百科mAccessFile(sMyFileName, "r");
BigFile.seek(2147483648);
   --> Exception

Thanks for any help, Michael


That is the result of the exception bubbling up from the native/IO (system) layer. It doesn't have to do with the size of the type in the language/VM itself. The error at the lower lever is EOVERFLOW ("Value to large for defined data type"). lseek, for instance, lists this error.

Hypothesis: The underlying system access isn't 64-bit "aware" :-) Some real JREs also had this problem historically, IIRC. Not sure what the story on android is.

Edit: The thread at FAT32 file size limited to 2GB seems to relate the Android 2.x (and contains details/hints/hypothesis about the kernel build and/or IO lib limitations -- consensus is "it doesn't work").

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜