diff options
author | lalottacontinua <loddatio@posteo.de> | 2018-06-27 22:44:33 +0200 |
---|---|---|
committer | lalottacontinua <loddatio@posteo.de> | 2018-06-27 22:44:33 +0200 |
commit | d63dd4b36701f2f993e671f8cc3c5424b787e43a (patch) | |
tree | 486a8c3a1a688e76c7da7f5d9f8dfddbcc0b58aa /app/src/main/java/se/leap/bitmaskclient/utils/InputStreamHelper.java | |
parent | 277f0f12ca505797daec42a5211885ac07b909f9 (diff) | |
parent | 8c9879145e588e985e5305ee2f88dfc1b6bf1d10 (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.java | 21 |
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() : ""; + } +} |