Last active
May 27, 2016 02:08
-
-
Save moskyb/49276883eb2c1af4bc565617423d3645 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
/** | |
* Looks for an existing transcript and reads it into an array if found. | |
* If the file doesn't exist it creates a new transcript. | |
* | |
* @param file File to read from | |
* @throws IOException | |
*/ | |
public void readFile(File file) throws IOException { | |
Charset charset = Charset.forName("utf-8"); | |
Arraylist<String> someList = new Arraylist<String>(); | |
try { | |
BufferedReader reader = Files.newBufferedReader(Paths.get(file.getAbsolutePath()), charset); | |
String line; | |
while ((line = reader.readLine()) != null) { | |
someList.put(line); | |
} | |
} catch (IOException x) { | |
//File does not exist... not possible as user cannot select nothing from a fileChooser | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment