Created
February 21, 2020 22:16
-
-
Save juniorcesarabreu/5014c5dc46ba780dc9b927bf887829a8 to your computer and use it in GitHub Desktop.
read complete file without using loop in java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File file = new File("a.txt"); | |
FileInputStream fis = new FileInputStream(file); | |
byte[] data = new byte[(int) file.length()]; | |
fis.read(data); | |
fis.close(); | |
String str = new String(data, "UTF-8"); | |
// https://stackoverflow.com/questions/14169661/read-complete-file-without-using-loop-in-java |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment