From 8bcda3407e8c0e62668fb17d55ffbf622fae6cf7 Mon Sep 17 00:00:00 2001 From: "arne@gaia.fritz.box" Date: Tue, 25 Dec 2012 23:00:42 +0100 Subject: Move opening of Inputstream to Configconvert --- src/de/blinkt/openvpn/ConfigConverter.java | 5 ++++- src/de/blinkt/openvpn/ConfigParser.java | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/de') diff --git a/src/de/blinkt/openvpn/ConfigConverter.java b/src/de/blinkt/openvpn/ConfigConverter.java index 3f204368..d140a1a4 100644 --- a/src/de/blinkt/openvpn/ConfigConverter.java +++ b/src/de/blinkt/openvpn/ConfigConverter.java @@ -6,6 +6,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.util.List; import java.util.Vector; @@ -387,7 +388,9 @@ public class ConfigConverter extends ListActivity { private void doImport(InputStream is) { ConfigParser cp = new ConfigParser(); try { - cp.parseConfig(is); + InputStreamReader isr = new InputStreamReader(is); + + cp.parseConfig(isr); VpnProfile vp = cp.convertProfile(); mResult = vp; embedFiles(); diff --git a/src/de/blinkt/openvpn/ConfigParser.java b/src/de/blinkt/openvpn/ConfigParser.java index 3d20bc31..7501ed17 100644 --- a/src/de/blinkt/openvpn/ConfigParser.java +++ b/src/de/blinkt/openvpn/ConfigParser.java @@ -2,8 +2,7 @@ package de.blinkt.openvpn; import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.Reader; import java.util.HashMap; import java.util.Vector; @@ -17,11 +16,10 @@ public class ConfigParser { private HashMap>> options = new HashMap>>(); - public void parseConfig(InputStream inputStream) throws IOException, ConfigParseError { + public void parseConfig(Reader reader) throws IOException, ConfigParseError { - InputStreamReader fr = new InputStreamReader(inputStream); - BufferedReader br =new BufferedReader(fr); + BufferedReader br =new BufferedReader(reader); @SuppressWarnings("unused") int lineno=0; @@ -229,6 +227,7 @@ public class ConfigParser { "route-gateway", "route-metric", "route-method", + "status", "show-net-up", "suppress-timestamps", "tmp-dir", -- cgit v1.2.3