I have this code which reads all the files from a directory.
File textFolder = new File(\"text_directory\");
File [] texFiles = textFolder.listFiles
public static ArrayList listItems(String path) throws Exception{
InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream(path);
byte[] b = new byte[in.available()];
in.read(b);
String data = new String(b);
String[] s = data.split("\n");
List a = Arrays.asList(s);
ArrayList m = new ArrayList<>(a);
return m;
}