Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- // read bytes until End Of File is encountered
- do {
- i = fin.read(); // Read from the file
- if(i != -1) System.out.print((char) i);
- } while(i != -1); // When i equals -1, the EOF has been reached
- } catch(IOException exc) {
- System.out.println("Error reading file.");
- } finally {
- // Close file on the way out of the try block
- try {
- fin.close(); // Close the file
- } catch(IOException exc) {
- System.out.println("Error closing file.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement