i have made program scans phone using recursion find epub files located under "/storage/emulated/0/"
. works, , can load files found , turn them inputstream
, cannot data them using this api. using same code load epub files assets folder works, however.
the code used turn file inputstream follows:
//example location booklocation = "/storage/emulated/0/downloads/book.epub" assetmanager assetmanager = getassets(); //does not work inputstream bookstream = new bytearrayinputstream(booklocation.getbytes("utf-8")); //works inputstream bookstream = assetmanager.open("book.epub");
you're wrapping booklocation string in bytearrayinputstream creates stream gives string when read from
what open fileinputstream on filepath in following way
new fileinputstream(booklocation);
adding code
//example location booklocation = "/storage/emulated/0/downloads/book.epub" setmanager assetmanager = getassets(); //does not work inputstream bookstream = new fileinputstream(booklocation); //works inputstream bookstream = assetmanager.open("book.epub");
Comments
Post a Comment