summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/utils/InputStreamHelper.java
diff options
context:
space:
mode:
authorlalottacontinua <loddatio@posteo.de>2018-06-27 22:44:33 +0200
committerlalottacontinua <loddatio@posteo.de>2018-06-27 22:44:33 +0200
commitd63dd4b36701f2f993e671f8cc3c5424b787e43a (patch)
tree486a8c3a1a688e76c7da7f5d9f8dfddbcc0b58aa /app/src/main/java/se/leap/bitmaskclient/utils/InputStreamHelper.java
parent277f0f12ca505797daec42a5211885ac07b909f9 (diff)
parent8c9879145e588e985e5305ee2f88dfc1b6bf1d10 (diff)
Merge branch 'master' into add_provider
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/utils/InputStreamHelper.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/utils/InputStreamHelper.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/InputStreamHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/InputStreamHelper.java
new file mode 100644
index 00000000..87996615
--- /dev/null
+++ b/app/src/main/java/se/leap/bitmaskclient/utils/InputStreamHelper.java
@@ -0,0 +1,21 @@
+package se.leap.bitmaskclient.utils;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+/**
+ * Created by cyberta on 18.03.18.
+ */
+
+public class InputStreamHelper {
+ //allows us to mock FileInputStream
+ public static InputStream getInputStreamFrom(String filePath) throws FileNotFoundException {
+ return new FileInputStream(filePath);
+ }
+
+ public static String loadInputStreamAsString(InputStream is) {
+ java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
+ return s.hasNext() ? s.next() : "";
+ }
+}