diff options
Diffstat (limited to 'app/src/main/java/com/wireguard/config')
-rw-r--r-- | app/src/main/java/com/wireguard/config/Config.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/config/Config.java b/app/src/main/java/com/wireguard/config/Config.java index 0599dec3..db8c2fc7 100644 --- a/app/src/main/java/com/wireguard/config/Config.java +++ b/app/src/main/java/com/wireguard/config/Config.java @@ -20,6 +20,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.StringReader; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -32,6 +33,10 @@ public class Config { private final Interface interfaceSection = new Interface(); private List<Peer> peers = new ArrayList<>(); + public static Config from(final String string) throws IOException { + return from(new BufferedReader(new StringReader(string))); + } + public static Config from(final InputStream stream) throws IOException { return from(new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))); } |