Hi everyone,
I am trying to to read and write large files about 600M.
The thing is when i use the normal FileOutputStream methods an exception gets thrown saying
java.lang.OutofMemory
This is how i am trying to read the file
FileOutputStream out = new FileOutputStream("C:/my_life_story.zip");
InputStream in = //an input stream from a socket, etc
int len = 0;
byte[] buffer1 = new byte[1024];
while ((len = in.read(buffer1)) > 0)
{
out.write(buffer1, 0, len);
}
in.close();
out.close();
My computer does have sufficient memory
I tried adding this in the while loop but it does not work and i got the same exception thrown by the JVM again
System.gc();
My question is basically how do i increase the memory programatically
or is there away in which i can read the file without having the above exception thrown by the JVM?
Any help i greatly appreciated
Thank You
Yours Sincerely
Richard West