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)
======================================================================
- duplicates
-
JDK-4116672 java.io does not support large files >2GB
-
- Closed
-