我有一个.txt文件,其中包含需要读取的所有500个XAML文件的位置和名称。
我必须在JAVA程序中使用.txt才能处理这些XAML文件。有人可以帮我提供代码吗?非常感谢。
这里是我快速执行的一些代码,我不知道它是否正是您想要的,但是它可用于从txt文件获取路径,然后从txt中指定的所有那些文件中读取信息。
BufferedReader br = new BufferedReader(new FileReader("path of your txt file"));
String path;
String string = " ";
//reads all lines in .txt file
BufferedReader reader;
while((path = br.readLine()) != null) {
//makes another buffered reader in the paths in the txt
reader = new BufferedReader(new FileReader(path));
while((string = reader.readLine()) != null) {
//reads from file in path and prints to console
System.out.println(string);
}
}