From b40f0edbe5e5d90fc1f3dff194a5e7c819633609 Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 15 May 2006 22:13:45 +0000 Subject: [PATCH] replaced property- and map-reader in AbstractRA by much faster version this has very strong effects of to all methods that read maps from kelondroDyn databases, i.e. news, seeds (bookmarks?) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2106 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- .../anomic/kelondro/kelondroAbstractRA.java | 41 +++---------------- 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/source/de/anomic/kelondro/kelondroAbstractRA.java b/source/de/anomic/kelondro/kelondroAbstractRA.java index 694558422..b44d5275c 100644 --- a/source/de/anomic/kelondro/kelondroAbstractRA.java +++ b/source/de/anomic/kelondro/kelondroAbstractRA.java @@ -44,8 +44,11 @@ package de.anomic.kelondro; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.InputStreamReader; import java.util.Enumeration; import java.util.Iterator; import java.util.Map; @@ -230,11 +233,10 @@ abstract class kelondroAbstractRA implements kelondroRA { writeLine("# EOF"); } - /* + public Properties readProperties() throws IOException { this.seek(0); byte[] b = readFully(); - //System.out.println("DEBUG-Properties:" + new String(b)); BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(b))); final Properties props = new Properties(); String line; @@ -249,22 +251,7 @@ abstract class kelondroAbstractRA implements kelondroRA { } return props; } - */ - public Properties readProperties() throws IOException { - this.seek(0); - final Properties props = new Properties(); - String line; - int pos; - while ((line = readLine()) != null) { - line = line.trim(); - if (line.equals("# EOF")) return props; - if ((line.length() == 0) || (line.charAt(0) == '#')) continue; - pos = line.indexOf("="); - if (pos < 0) continue; - props.setProperty(line.substring(0, pos).trim(), line.substring(pos + 1).trim()); - } - return props; - } + /* public void writeMap(final Map map, final String comment) throws IOException { this.seek(0); @@ -303,11 +290,9 @@ abstract class kelondroAbstractRA implements kelondroRA { writeLine("# EOF"); } - /* public Map readMap() throws IOException { this.seek(0); byte[] b = readFully(); - //System.out.println("DEBUG-READ-MAP:" + new String(b)); BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(b))); final TreeMap map = new TreeMap(); String line; @@ -322,22 +307,6 @@ abstract class kelondroAbstractRA implements kelondroRA { } return map; } - */ - public Map readMap() throws IOException { - this.seek(0); - final TreeMap map = new TreeMap(); - String line; - int pos; - while ((line = readLine()) != null) { // very slow readLine???? - line = line.trim(); - if (line.equals("# EOF")) return map; - if ((line.length() == 0) || (line.charAt(0) == '#')) continue; - pos = line.indexOf("="); - if (pos < 0) continue; - map.put(line.substring(0, pos), line.substring(pos + 1)); - } - return map; - } /** * this does not write the content to the see position