What is the file size limit on the Android File System (specifically
on an sdcard)?
I have a test program that opens a file greater than INT_MAX
(2,147,483,647 bytes) in size, java.io.FileInputStream and
java.io.File are able to operate on the file, but FileChannel returned
from FileInputStream.getChannel() works only when the position is
below INT_MAX.
Specifically:
- java.io.File.length() returns the correct length.
- FileInputStream.read() can consume read the whole fiile (I was doing
in 8K chunks)
- FileInputStream.getChannel().size() throws an IOException.
- FileInputStream.getChannel().position(long) works when offset is
less that or equal to INT_MAX. If it it greater than INT_MAX the file
position after the position(long) call is always INT_MAX (even if I
perform a subsequent FileInputStream.skip()).
- If the position of the file is greater than INT_MAX any call to
FileInputStream.getChannel().position() to read the file position
throws an IOException().
The exception stack is:
java.io.IOException
at org.apache.harmony.luni.platform.OSFileSystem.seek
(OSFileSystem.java:110)
at org.apache.harmony.nio.internal.FileChannelImpl.size
(FileChannelImpl.java:393)
..... my code
A quick look reveals that FileChannelImpl.size() is calling
OSFileSystem.seek(handle, 0, IFileSystem.SEEK_END);
The implementation of OSFileSystem.seek is making a call to the native
method harmony_io_seekImpl() which is using lseek() to get to the end
of file. I though that call would handle >32 bits???
Any ideas appreciated.
Thanks,
Nic
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---