我正在根据\t
我想要的内容解析文件数据,如果发现不止一个\t
,则从下一个新行开始解析并从 0 开始 arraylist 单词。
public static void readFile() throws IOException {
String line;
ArrayList<String> words = new ArrayList<String>();
try {
BufferedReader inFile = new BufferedReader (new FileReader ("/weather.txt"));
while ((line = inFile.readLine()) != null) {
StringTokenizer token= new StringTokenizer(line,"\t");
while (token.hasMoreTokens()) {
words.add(token.nextToken());
}
/*
* function to print the values
*/
getMetadataTriple(words);
}
}