for my android app i need to download a JSON from a url into android's internal storage and then read from it. I think that the best way to save it as byte[] into internal storage although i have some problems here is what i've written so far
File storage = new File("/sdcard/appData/photos");
storage.mkdirs();
JSONParser jParser = new JSONParser();
// getting JSON from URL
JSONObject json = jParser.getJSONFromUrl(url1);
//transforming jsonObject to byte[] and store it
String jsonString = json.toString();
byte[] jsonArray = jsonString.getBytes();
String filen = "jsonData";
File fileToSaveJson = new File("/sdcard/appData",filen);
FileOutputStream fos;
fos = new FileOutputStream(fileToSaveJson);
fos = openFileOutput(filen,Context.MODE_PRIVATE);
fos.write(jsonArray);
fos.close();
//reading jsonString from storage and transform it into jsonObject
FileInputStream fis;
File readFromJson = new File("/sdcard/appData/jsonData");
fis = new FileInputStream(readFromJson);
fis = new FileInputStream(readFromJson);
InputStreamReader isr = new InputStreamReader(fis);
fis.read(new byte[(int)readFromJson.length()]);
but it won't open the file in order to read it