Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4100321

random access to files larger than 2 gig

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.3, 1.1.5
    • core-libs
    • sparc
    • solaris_2.5.1, solaris_2.6



      Name: dgC58589 Date: 12/18/97


      run the attached: java BigFile 3000 testfile
      Works fine up to 2000, can't create 3 gig file!

      Source:

      // BigFile.java

      import java.io.*;

      public class BigFile {

        public static void main(String [] args){
          if (args.length<2){
            System.err.println("Usage: java BigFile sizeInMegs FileName");
            return;
          }
          byte[] meg = new byte[1024*1024];
          int sizeInMegs = Integer.parseInt(args[0]);
            long sk = sizeInMegs;
            sk = sk * meg.length;
          System.out.println("Creating "+args[1]+" of "+(sk+args[0].length()+1)+" bytes called bigfile.tst");
          try {
            RandomAccessFile raf = new RandomAccessFile(args[1], "rw");
            raf.seek(sk);
            raf.writeBytes(args[0]+"\n");
          raf.close();
          }catch(Exception e){
            System.err.println(e);
          }
        }
      }
      (Review ID: 22089)
      ======================================================================

            dviswanasunw Deepa Viswanathan (Inactive)
            dgrahamcsunw David Graham-cumming (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: