diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/access/DefinitionParser.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/access/DefinitionParser.java
index ebbfcd125ca6294bca2d0d565d12f03673aef8eb..9fea9fd7d3ba6f2b9c0a3007cf443463ad0d2e87 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/access/DefinitionParser.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/access/DefinitionParser.java
@@ -1,40 +1,25 @@
 package net.i2p.i2ptunnel.access;
 
-import java.io.File;
-import java.io.FileReader;
-import java.io.BufferedReader;
-import java.io.IOException;
-
 import java.util.List;
 import java.util.ArrayList;
 
+import java.io.File;
+
 class DefinitionParser {
 
-    static FilterDefinition parse(File f) throws IOException, InvalidDefinitionException {
+    static FilterDefinition parse(String []definition) throws InvalidDefinitionException {
         
         DefinitionBuilder builder = new DefinitionBuilder();
 
-        BufferedReader reader = new BufferedReader(new FileReader(f));
-        try {
-            String line;
-            while((line = reader.readLine()) != null) {
-                line = line.trim();
-                if (line.isEmpty())
-                    continue;
-                if (line.startsWith("#"))
-                    continue;
-
-                String [] split = line.split(" \t");
-                split[0] = split[0].toLowerCase();
-                if ("default".equals(split[0])) 
-                    builder.setDefaultThreshold(parseThreshold(line.substring(7).trim()));
-                else if ("recorder".equals(split[0]))
-                    builder.addRecorder(parseRecorder(line.substring(8).trim()));
-                else
-                    builder.addElement(parseElement(line));
-            }
-        } finally {
-            if (reader != null) try { reader.close(); } catch (IOException ignored) {}
+        for (String line : definition) {
+            String [] split = line.split(" \t");
+            split[0] = split[0].toLowerCase();
+            if ("default".equals(split[0])) 
+                builder.setDefaultThreshold(parseThreshold(line.substring(7).trim()));
+            else if ("recorder".equals(split[0]))
+                builder.addRecorder(parseRecorder(line.substring(8).trim()));
+            else
+                builder.addElement(parseElement(line));
         }
 
         return builder.build();
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/access/FilterFactory.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/access/FilterFactory.java
new file mode 100644
index 0000000000000000000000000000000000000000..fa9558507e689fd0337ae3e67a5cedf2bfd494dd
--- /dev/null
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/access/FilterFactory.java
@@ -0,0 +1,37 @@
+package net.i2p.i2ptunnel.access;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileReader;
+import java.io.BufferedReader;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import net.i2p.I2PAppContext;
+import net.i2p.client.streaming.IncomingConnectionFilter;
+
+public class FilterFactory {
+    public static IncomingConnectionFilter createFilter(I2PAppContext context, File definition) 
+        throws IOException, InvalidDefinitionException {
+        List<String> linesList = new ArrayList<String>();
+
+        BufferedReader reader = new BufferedReader(new FileReader(definition));
+        try {
+            String line;
+            while((line = reader.readLine()) != null) {
+                line = line.trim();
+                if (line.length() == 0)
+                    continue;
+                if (line.startsWith("#"))
+                    continue;
+                linesList.add(line);
+            }
+        } finally {
+            if (reader != null) try { reader.close(); } catch (IOException ignored) {}
+        }
+
+        FilterDefinition parsedDefinition = DefinitionParser.parse(linesList.toArray(new String[0]));
+        return new AccessFilter(context, parsedDefinition);
+    }
+}