Code example for InputStream

Methods: availablecloseread

0
    private String getAssetsFileContent(AssetManager assetManager, String fileName) throws IOException {
        String result = "";
        InputStream inputStream = null;
        try { 
            inputStream = assetManager.open(fileName);
            int size = inputStream.available();
            byte[] buffer = new byte[size];
            inputStream.read(buffer);
            result = new String(buffer);
        } finally { 
            if (inputStream != null) {
                inputStream.close();
            } 
        } 
        return result;
    } 
 
    private Object createExtensionContextClient(XWalkExtensionContextWrapper contextWrapper) {
        Activity activity = contextWrapper.getActivity();
        try { 
Stop searching for code, let great code find you!  Add Codota to your java IDE