I am making an RMI call to get the contents of the file in the form of StringBuffer to display that in the text Area.
When i receive the stringBuffer in my UI, its size is nearly 6 times that of the original file. i.e. if the file size is 2mb
StringBuffer size increase to around 12-13 mb. I am creating the buffer like this
public StringBuffer getBuffer()
STringBuffer strFileContents = new StringBuffer();
File fSgFile = new File(name);
FileReader fReadder = new FileReader(fSgFile);
BufferedReader bReader = new BufferedReader(fReadder);
while ( (strLine=bReader.readLine()) != null)
// APPEND THE LINE TO THE BUFFER
strFileContents.append( "\n" )
Further add to the problem is JTextArea.When I add this StringBuffer to the text Area. Memory usuage again increases
How can I reduce these things.