N
Nishi Bhonsle
Hi:
I have the following code to read from a BufferedReader and save it to a string (contents separated by \n).
Is there anyway that I can improve the performance of this? Currently this operation runs over longer duration for not so big a file.
Thanks.
==========================================================
java.io.InputStream is = new BufferedInputStream(new FileInputStream("abc.xml"));
BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String fileContents;
String newContents = " ";
String lineSeparator = System.getProperty("line.separator");
while ((fileContents = in.readLine()) != null)
{
newContents=newContents.concat(fileContents);
newContents=newContents.concat(lineSeparator);
}
I have the following code to read from a BufferedReader and save it to a string (contents separated by \n).
Is there anyway that I can improve the performance of this? Currently this operation runs over longer duration for not so big a file.
Thanks.
==========================================================
java.io.InputStream is = new BufferedInputStream(new FileInputStream("abc.xml"));
BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String fileContents;
String newContents = " ";
String lineSeparator = System.getProperty("line.separator");
while ((fileContents = in.readLine()) != null)
{
newContents=newContents.concat(fileContents);
newContents=newContents.concat(lineSeparator);
}