Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. public static String getStringFromFile(InputStream fromFile) throws IOException {
  2. // Use FileInputStream to read the file
  3. FileInputStream datFile = (FileInputStream)fromFile;
  4.  
  5. byte[] b = new byte[datFile.available()];
  6. datFile.read(b);
  7.  
  8. // get the content of file
  9. String datFileContent = new String(b);
  10. datFile.close();
  11.  
  12. return datFileContent;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement