Is there is abetter performance to read from file than my code for longfile

Hi

This is my code to read from file and show it in a text area ,but for long file it wait for along time to show the file ,Is there is better performance code?

chooser=new JFileChooser();

chooser.showOpenDialog(sav);

File fe=new File(chooser.getSelectedFile().getAbsolutePath());

//out = new PrintWriter(new FileOutputStream(f));

in2 =new BufferedReader(new FileReader(fe));

str=in2.readLine();

if(str!=null)

nn2=str;

str=in2.readLine();

try{

while((str)!=null)

{ nn2=nn2+"\n"+str;

str=in2.readLine();

}}catch(NullPointerException e){}

jta2.setText(nn2);

in2.close();

// in2 = new BufferedReader(new FileReader(fe));

}catch (IOException ex){

}catch(NullPointerException e){}

nn1=str;

[1605 byte] By [Elnegma] at [2007-10-3 5:13:29]
# 1
Yes you code would be slow because you are continually creating new string by concatenating one string to another.The easiest way is to simply use the read(...) method of the text area.
camickra at 2007-7-14 23:19:57 > top of Java-index,Desktop,Core GUI APIs...