summaryrefslogtreecommitdiff
path: root/app/src/androidTest/java/se/leap/bitmaskclient/test/FromAssets.java
blob: fd8b9a7e7d9e7035cdefcb8bff3e8a38c4d9475d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package se.leap.bitmaskclient.test;

import android.content.*;
import org.json.*;
import java.io.*;

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;
    }
}