java - String buffer - OutOfMemoryError -


i having string buffer variable holds input read file. cases getting input file in huge size. in cases getting outofmemoryerror.

here code:

stringbuffer response = new stringbuffer(""); bufferedreader in = new bufferedreader(isr); string inputline; while ((inputline = in.readline()) != null)         response.append(inputline); in.close(); 

kindly me how resolve issue.

either read input in chunks, or change -xmx parameter (maximum memory size) in jvm larger size.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -