Problem while writing to file, size greater than 15MB ..?
FileReader reader = new FileReader("c:/sample.sql");
BufferedReader buffer = new BufferedReader(reader);
String readLine = null;
StringBuffer line = new StringBuffer();
while ((readLine = buffer.readLine()) != null)
line.append(readLine + "\n");
In the above code "sample.sql" file size is around 15MB so it throws an "java.outof Memory exception" Java Heap space error...
Please help me how to write a large file to a file using java.
Also i need the full data from the file, i need all the data of size 15MB to write to a file.
Problem while writing to file, using string buffer
Hi steve it sounds great, however is it ok to do by setting the StringBuffer length, by using StringBuffer.setLength(File.length());
Please let me know if it is bad idea.
How to read a file upto a certain block and write to a file and then the remaining.
Please do you have any sample code for this it would be better.
Also my file size would be greater than 1GB or 2GB.