I'm submitting html form from java applet by setting the hidden element to bytes converted to BASE64 read from local filepath.
DataInputStream dataInputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(filePath)));
dataInputStream.readFully(bytes);
String base64_str = Base64Utils.base64Encode(bytes);
JSObject mainForm = (JSObject)browserWindow.eval("document.myform");
JSObject Field = (JSObject)mainForm.getMember(FieldName);
Field.setMember("value", base64_str);
Here when file being read is around 1.5Mb it works okay, but above that exception java.lang.OutOfMemoryError is issued.
I am using HTML to submit file to use the browser session and to avoid steps to upload the file which is being preprocessed within applet first.
What is the maximum limit I can read the file into string and set hidden field? How do I increase the memory of the applet?