blob: 4f7719225a7abd9b3fdf3eae05830ee4a14a2873 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package se.leap.bitmaskclient.test;
import android.content.Context;
import org.json.JSONException;
import java.io.IOException;
import java.io.InputStream;
public class FromAssets {
Context context;
public FromAssets(Context context) {
this.context = context;
}
public String toString(String filename) throws IOException, JSONException {
String result = "";
InputStream is = context.getAssets().open(filename);
byte[] bytes = new byte[is.available()];
if(is.read(bytes) > 0) {
result = new String(bytes);
}
return result;
}
}
|