Large File Support

C

Chris Bentz

Anyone have any pointers on Large File Support (i.e. > 2 GB).

java.io.File.Length() is a long, 32bit, and will not return the size
properly.

Thanks in Advance,
Chris.
 
M

Marco Schmidt

Chris Bentz:
Anyone have any pointers on Large File Support (i.e. > 2 GB).

java.io.File.Length() is a long, 32bit, and will not return the size
properly.

length() returns a long, but that is always 64 bits large in Java.

If it really does not return a correct size for large files you have
probably found a bug.

Regards,
Marco
 
?

=?ISO-8859-1?Q?Daniel_Sj=F6blom?=

Chris said:
Anyone have any pointers on Large File Support (i.e. > 2 GB).

java.io.File.Length() is a long, 32bit, and will not return the size
properly.

Thanks in Advance,
Chris.

Long is 64 bits. Are you sure your filesystem can handle files larger
than 2 Gb?
 
T

Tor Iver Wilhelmsen

Chris Bentz said:
Oh. Ok - then I have no problems. Thanks.

Also if you can use java.nio.* (JRE 1.4.x and later), look at
java.nio.channels.FileChannel and related classes.
 
B

Brad BARCLAY

Chris said:
Anyone have any pointers on Large File Support (i.e. > 2 GB).

java.io.File.Length() is a long, 32bit, and will not return the size
properly.

A long in Java is 64 bits, but the problem is a lot more complicated
than that.

There are a few issues that need to be addressed within the JRE to
properly handle such large files:

1) Does the underlying filesystem support files this large? Many less
recent filesystems don't.

2) Is the JRE using the correct OS APIs to handle large files? As the
concept of filesystems being able to handle such large files is fairly
recent, many of the core APIs are build around 32 bit integer values.
In order to retain backward compatibility, many OS's, instead of
changing the existing API calls that are using 32 bit ints, added new
calls that support 64 bit ints. If the JRE is still using the original
API, and not the newer 64-bit capable calls, then even if you have a
64-bit enabled filesystem you're still not going to be able to handle
large files.

HTH!

Brad BARCLAY
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top