diff --git a/src/main/java/com/hashbangbash/trie/App.java b/src/main/java/com/hashbangbash/trie/App.java index fafa21c..0a6df63 100644 --- a/src/main/java/com/hashbangbash/trie/App.java +++ b/src/main/java/com/hashbangbash/trie/App.java @@ -1,14 +1,25 @@ package com.hashbangbash.trie; +import java.util.List; +import java.util.ArrayList; +import java.util.Arrays; + import java.io.DataInputStream; import java.io.FileInputStream; +import java.io.InputStreamReader; import java.io.BufferedReader; + import java.io.FileNotFoundException; +import java.io.IOException; public class App { public static void main(String[] args) { FileInputStream fis; DataInputStream in; + BufferedReader br; + + String content; + List contentList; for (String arg : args) { try { @@ -20,6 +31,21 @@ public class App { System.out.printf("ERROR: [%s] %s\n", arg, t); continue; } + + in = new DataInputStream(fis); + br = new BufferedReader(new InputStreamReader(in)); + contentList = new ArrayList(); + + try { + while ((content = br.readLine()) != null) { + contentList.add(content); + } + } catch (IOException ex) { + System.out.printf("ERROR: [%s] - %s\n", arg, ex); + continue; + } + + System.out.println(contentList.toString()); } } }