I've been struggling with a large generated string, while trying to save it to a file.
This string comes from com.sap.conn.jco.JCoFunction.toXML(); method.
I'm trying this:
public static void writeXML(JCoFunction jcoFunction, String path){
File f = new File("C:/XMLFile.xml");
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(f));
bw.write("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?> ");
bw.write(jcoFunction.toXML());
bw.close();
} catch (Exception e) {
e.printStackTrace();
}
}
This should create a xml, approximately 45KB size. But I get a java heap space error. I need help to make a efficient method, to avoid said error.
Thanks in advance!