Advertisement
Guest User

Untitled

a guest
May 26th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. /**
  2. * Looks for an existing transcript and reads it into an array if found.
  3. * If the file doesn't exist it creates a new transcript.
  4. *
  5. * @param file File to read from
  6. * @throws IOException
  7. */
  8. public void readFile(File file) throws IOException {
  9. Charset charset = Charset.forName("utf-8");
  10. Arraylist<String> someList = new Arraylist<String>();
  11. try {
  12. BufferedReader reader = Files.newBufferedReader(Paths.get(file.getAbsolutePath()), charset);
  13. String line;
  14. while ((line = reader.readLine()) != null) {
  15. someList.put(line);
  16. }
  17. } catch (IOException x) {
  18. //File does not exist... not possible as user cannot select nothing from a fileChooser
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement