Hello guys,
Can anybody have any idea how to read a binary file which resides in sdcard using Streams, like Inputstream, CountingInputStream or SwappedDataInputStream?
I am using these three streams to read a file which is currently in the Resouces folder, but now i want to move that file in sdcard but I cannot change these stream because I have done so much work on it and I cannot roll back my work. i am doing it this way but its giving me FileNotFoundException. i need your help please.
AssetManager assetManager = getResources().getAssets(); final File folder = new File(Environment.getExternalStorageDirectory() + "/map"); boolean success = false; if(!folder.exists()) { success = folder.mkdir(); } else { Log.i("folder already exists", "folder already exists"); }
try { iStream = assetManager.open(Environment.getExternalStorageDirectory().getAbsolutePath().concat("/map/map.amf"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
cis = new CountingInputStream(iStream);
input = new SwappedDataInputStream(cis);
Thanks a lot for any suggestion.