jar ファイル内の複数のファイルを読み取りたい。しかし、うまくいきません。1 つのファイルだけを読み取って停止します。Inputstream
仕組みや仕組みがよくわかりませんBufferedreader
。コードのその部分は別の投稿から借用しています。
for (int i = 0; i < numList; i++) { // numList is number of file I want to read
int fileNum = i + 1;
String fileaddress = "List" + fileNum + ".txt";
//All the files have name like "List1.txt", "List2.txt", etc
InputStream configStream = getClass().getResourceAsStream(fileaddress);
BufferedReader wordReader = new BufferedReader(new InputStreamReader(configStream, "UTF-8"));
//the following is to store values in the line in an String array
//add the array to an ArrayList called masterList
String[] line;
while((line = wordReader.readLine().split(": ")) != null){
masterList.add(line);
}