performance fix in http parser

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6760 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 90dd197ae7
commit e0da0a84b0

@ -280,16 +280,21 @@ public class ContentScraper extends AbstractScraper implements Scraper {
} }
private static String cleanLine(String s) { private static String cleanLine(String s) {
// may contain too many funny symbols StringBuilder sb = new StringBuilder(s.length());
for (int i = 0; i < s.length(); i++) char c, l = ' ';
if (s.charAt(i) < ' ') s = s.substring(0, i) + " " + s.substring(i + 1); for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
// remove double-spaces if (c < ' ') c = ' ';
int p; if (c == ' ') {
while ((p = s.indexOf(" ")) >= 0) s = s.substring(0, p) + s.substring(p + 1); if (l != ' ') sb.append(c);
} else {
sb.append(c);
}
l = c;
}
// return result // return result
return s.trim(); return sb.toString().trim();
} }
public String getTitle() { public String getTitle() {

Loading…
Cancel
Save