From 9f336dd05b04b358d32872a2651dcfc512c7dce0 Mon Sep 17 00:00:00 2001
From: ragnarok <ragnarok>
Date: Fri, 30 Sep 2005 05:28:31 +0000
Subject: [PATCH] Provide a store method on PetNameDB that takes no arguments,
 and writes the db back to where it was loaded from.

---
 core/java/src/net/i2p/client/naming/PetNameDB.java | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/core/java/src/net/i2p/client/naming/PetNameDB.java b/core/java/src/net/i2p/client/naming/PetNameDB.java
index 730cc4e6b4..a1d91ea903 100644
--- a/core/java/src/net/i2p/client/naming/PetNameDB.java
+++ b/core/java/src/net/i2p/client/naming/PetNameDB.java
@@ -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);
+        }
+    }
 }
-- 
GitLab