Large File Support

Discussion in 'Java' started by Chris Bentz, Sep 13, 2003.

  1. Chris Bentz

    Chris Bentz Guest

    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.
    Chris Bentz, Sep 13, 2003
    #1
    1. Advertising

  2. 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
    --
    Please reply in the newsgroup, not by email!
    Java programming tips: http://jiu.sourceforge.net/javatips.html
    Other Java pages: http://www.geocities.com/marcoschmidt.geo/java.html
    Marco Schmidt, Sep 13, 2003
    #2
    1. Advertising

  3. Chris Bentz

    Chris Bentz Guest

    Oh. Ok - then I have no problems. Thanks.

    Chris.

    "Marco Schmidt" <> wrote in message
    news:...
    > 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
    > --
    > Please reply in the newsgroup, not by email!
    > Java programming tips: http://jiu.sourceforge.net/javatips.html
    > Other Java pages: http://www.geocities.com/marcoschmidt.geo/java.html
    Chris Bentz, Sep 13, 2003
    #3
  4. Chris Bentz wrote:

    > 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?
    --
    Daniel Sjöblom
    =?ISO-8859-1?Q?Daniel_Sj=F6blom?=, Sep 13, 2003
    #4
  5. "Chris Bentz" <> writes:

    > 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.
    Tor Iver Wilhelmsen, Sep 13, 2003
    #5
  6. Chris Bentz

    Roedy Green Guest

    On Sat, 13 Sep 2003 16:32:07 -0400, "Chris Bentz" <>
    wrote or quoted :

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


    a long is 64 bits. That ought to handle any file I've ever heard of.

    see http://mindprod.com/jgloss/primitive.html

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Sep 14, 2003
    #6
  7. Chris Bentz

    Brad BARCLAY Guest

    Chris Bentz wrote:
    > 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

    --
    =-=-=-=-=-=-=-=-=
    From the OS/2 WARP v4.5 Desktop of Brad BARCLAY.
    The jSyncManager Project: http://www.jsyncmanager.org
    
    Brad BARCLAY, Sep 14, 2003
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joseph

    large file support

    Joseph, Dec 2, 2004, in forum: C++
    Replies:
    7
    Views:
    616
    Karl Heinz Buchegger
    Dec 3, 2004
  2. Mathew
    Replies:
    0
    Views:
    269
    Mathew
    Nov 25, 2003
  3. Tim Peters
    Replies:
    2
    Views:
    308
    Mathew
    Nov 25, 2003
  4. Robin Friedrich

    Build with large file support on AIX

    Robin Friedrich, Jan 21, 2004, in forum: Python
    Replies:
    0
    Views:
    313
    Robin Friedrich
    Jan 21, 2004
  5. Replies:
    5
    Views:
    873
    Xho Jingleheimerschmidt
    Apr 2, 2009
Loading...

Share This Page