I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 9f336dd0 authored by ragnarok's avatar ragnarok Committed by zzz
Browse files

Provide a store method on PetNameDB that takes no arguments, and writes the db...

Provide a store method on PetNameDB that takes no arguments, and writes the db back to where it was loaded from.
parent 411ca5e6
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ import java.util.*;
public class PetNameDB {
/** name (String) to PetName mapping */
private Map _names;
private String _path;
public PetNameDB() {
_names = Collections.synchronizedMap(new HashMap());
......@@ -55,10 +56,12 @@ public class PetNameDB {
if (name.getName() != null)
_names.put(name.getName(), name);
}
_path = location;
} finally {
in.close();
}
}
public void store(String location) throws IOException {
Writer out = null;
try {
......@@ -72,4 +75,10 @@ public class PetNameDB {
out.close();
}
}
public void store() throws IOException {
if (_path != null) {
store(_path);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment