List of usage examples for org.apache.cordova CordovaResourceApi copyResource
public void copyResource(Uri sourceUri, Uri dstUri) throws IOException
From source file:org.chromium.ChromeStorage.java
License:Open Source License
private JSONObject getStorage(String namespace) throws IOException, JSONException { JSONObject oldMap = new JSONObject(); CordovaResourceApi resourceApi = webView.getResourceApi(); try {/* w ww . j a va2 s . c o m*/ OpenForReadResult readResult = resourceApi.openForRead(getStorageFile(namespace)); ByteArrayOutputStream readBytes = new ByteArrayOutputStream((int) readResult.length); resourceApi.copyResource(readResult, readBytes); byte[] bytes = readBytes.toByteArray(); String content = (new String(bytes)).trim(); if (content.length() > 0) { oldMap = new JSONObject(content); } } catch (FileNotFoundException e) { //Suppress the file not found exception } return oldMap; }