Created
March 25, 2017 00:56
-
-
Save rokon12/f817a0de6ac6cb637fdc345addf7fa58 to your computer and use it in GitHub Desktop.
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
import java.io.FileInputStream; | |
import java.io.IOException; | |
public class FilePrinter { | |
private static void printFileJava7() { | |
try (FileInputStream fis = new FileInputStream("file.txt")) { | |
int data; | |
while ((data = fis.read()) != -1) { | |
System.out.print((char) data); | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment