removed some unused methods

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2118 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 232ab7902b
commit e656a00b74

@ -49,10 +49,8 @@ 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;
import java.util.Properties;
import java.util.TreeMap;
abstract class kelondroAbstractRA implements kelondroRA {
@ -194,47 +192,6 @@ abstract class kelondroAbstractRA implements kelondroRA {
}
}
public void writeProperties(final Properties props, final String comment) throws IOException {
this.seek(0);
final Enumeration e = props.propertyNames();
String key, value;
StringBuffer sb = new StringBuffer(props.size() * 40);
sb.append("# " + comment);
sb.append(cr);
sb.append(lf);
while (e.hasMoreElements()) {
key = (String) e.nextElement();
value = props.getProperty(key, "");
sb.append(key);
sb.append('=');
sb.append(value);
sb.append(cr);
sb.append(lf);
}
sb.append("# EOF");
sb.append(cr);
sb.append(lf);
write(new String(sb).getBytes());
}
public Properties readProperties() throws IOException {
this.seek(0);
byte[] b = readFully();
BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(b)));
final Properties props = new Properties();
String line;
int pos;
while ((line = br.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);
final Iterator iter = map.entrySet().iterator();

@ -46,7 +46,6 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Map;
import java.util.Properties;
public final class kelondroFileRA extends kelondroAbstractRA implements kelondroRA {
@ -97,31 +96,6 @@ public final class kelondroFileRA extends kelondroAbstractRA implements kelondro
}
// some static tools
public static void writeProperties(File f, Properties props, String comment) throws IOException {
File fp = f.getParentFile();
if (fp != null) fp.mkdirs();
kelondroRA kra = null;
try {
kra = new kelondroFileRA(f);
kra.writeProperties(props, comment);
kra.close();
} finally {
if (kra != null) try {kra.close();}catch(Exception e){}
}
}
public static Properties readProperties(File f) throws IOException {
kelondroRA kra = null;
try {
kra = new kelondroFileRA(f);
Properties props = kra.readProperties();
kra.close();
return props;
} finally {
if (kra != null) try{kra.close();}catch(Exception e) {}
}
}
public static void writeMap(File f, Map map, String comment) throws IOException {
File fp = f.getParentFile();
if (fp != null) fp.mkdirs();

@ -52,7 +52,6 @@ package de.anomic.kelondro;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
public interface kelondroRA {
@ -71,7 +70,7 @@ public interface kelondroRA {
// derived methods:
public void readFully(byte[] b, int off, int len) throws IOException;
//public byte[] readFully() throws IOException;
public byte[] readFully() throws IOException;
public byte readByte() throws IOException;
public void writeByte(int v) throws IOException;
@ -89,10 +88,6 @@ public interface kelondroRA {
public void writeLine(String line) throws IOException;
public String readLine() throws IOException;
// tool methods that organize the complete content
public void writeProperties(Properties props, String comment) throws IOException;
public Properties readProperties() throws IOException;
public void writeMap(Map props, String comment) throws IOException;
public Map readMap() throws IOException;

Loading…
Cancel
Save