| Author |
Not able to convert large sized byte array to String
|
Kinnaree Patel
Ranch Hand
Joined: Oct 30, 2007
Posts: 33
|
|
Hi all,
I have written a code to upload file to server. When the files are small (around 3MB), it works great. But when i try to upload files of greater size, around 5MB, I start getting OutOfMemory errors (on local machine) and the file does not get upload when I upload EAR to UAT environment. On UAT environment, I do not get any significant errors in log and a open dialog pop up appears while file is being uploaded, ultimately doing nothing. Below is my code that seems to create problems:
On local, when I debug to line System.out.println("saveFile : " + saveFile); it gives me out of memory error. The problem is that dataBytes is not getting converted to file at file = new String(dataBytes);
Any suggestions would be a great help at this stage. I am working on tight deadline and unfortunately none of the solutions found through googling worked!
Thanks,
Kinnaree
|
95% people read history, 5% create it... On The Way To 5%...
SCJP 5.0 -> 88%, SCWCD -> 86%, Next -> SCBCD and SCDJWS
|
 |
Swastik Dey
Ranch Hand
Joined: Jan 08, 2009
Posts: 1188
|
|
Does this help?
|
Swastik
|
 |
Kinnaree Patel
Ranch Hand
Joined: Oct 30, 2007
Posts: 33
|
|
Hi Swastik,
Not really. We are still using jdk1.4
|
 |
Swastik Dey
Ranch Hand
Joined: Jan 08, 2009
Posts: 1188
|
|
|
May be you can switch to StringBuffer instead of StringBuilder and see if it helps.
|
 |
 |
|
|
subject: Not able to convert large sized byte array to String
|
|
|