Last active
September 28, 2015 09:08
-
-
Save hacksoldier/293c7800760ba3ea00b0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public void readFileFromDisk (String path, String fileName){ | |
| try{ | |
| bufferReader = new BufferedReader(new FileReader("C:\\dati\\fileDiTest.txt")); | |
| StringBuilder sb = new StringBuilder(); | |
| String line = bufferReader.readLine(); | |
| while (line != null) { | |
| sb.append(line); | |
| sb.append(System.lineSeparator()); | |
| line = bufferReader.readLine(); | |
| } | |
| String everything = sb.toString(); | |
| log.debug("everything: " + everything); | |
| } catch (FileNotFoundException fileNotFoundException) { | |
| log.error("Error in readFileFromDisk - File not foud", fileNotFoundException); | |
| } catch (IOException ioe){ | |
| log.error("Error in readFileFromDisk - Generic i/o error", ioe); | |
| } finally { | |
| if (bufferReader != null) { | |
| bufferReader.close; | |
| } | |
| } | |
| } | |
| //call example: readFileOnDisk("C:\\dati\\", "fileTest.txt"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment