*) Using StringBuffer instead of String concatenation

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1018 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent 452db479cd
commit 3d0dfd4df4

@ -163,15 +163,21 @@ public class listManager {
} }
public static String getListString(String filename, boolean withcomments){ public static String getListString(String filename, boolean withcomments){
String temp = ""; StringBuffer temp = new StringBuffer();
String line = "";
BufferedReader br = null; BufferedReader br = null;
try{ try{
br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(listsPath ,filename)))); File listFile;
br = new BufferedReader(new InputStreamReader(new FileInputStream(listFile = new File(listsPath ,filename))));
temp.ensureCapacity((int) listFile.length());
// Read the List // Read the List
String line = "";
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
if ((!line.startsWith("#") || withcomments) || !line.equals("")) { if ((!line.startsWith("#") || withcomments) || !line.equals("")) {
temp += line + serverCore.crlfString; //temp += line + serverCore.crlfString;
temp.append(line)
.append(serverCore.crlfString);
} }
} }
br.close(); br.close();
@ -180,7 +186,7 @@ public class listManager {
if (br!=null) try { br.close(); } catch (Exception e) {} if (br!=null) try { br.close(); } catch (Exception e) {}
} }
return temp; return temp.toString();
} }
// get a Directory Listing as a String Array // get a Directory Listing as a String Array

Loading…
Cancel
Save