Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. AssetManager am = getAssets();
  2. InputStream is = null;
  3. try {
  4.                 is = am.open(filepath);
  5.             } catch (IOException e) {
  6.                 Log.d("ARTIGOS", "Failed to open " + artigosFich[i]);
  7.                
  8.             }
  9. byte[] buffer;
  10.             try {
  11.                 int size = is.available();
  12.                 buffer = new byte[size];
  13.                 is.read(buffer);
  14.             } catch (IOException e) {
  15.                 Log.d("ARTIGOS", "Failed to read " + artigosFich[i]);
  16.                 continue;
  17.             } finally {
  18.                 try {
  19.                     is.close();
  20.                 } catch (IOException e) {
  21.                     e.printStackTrace();
  22.                 }
  23. String textoDoFicheiro = new String(buffer);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement