-2
public void tokenize(){
// attempt creating a reader for the input
reader = this.newReader();
while((line = reader.readLine())!=null){
tokenizer = new StringTokenizer(line);
while(tokenizer.hasMoreTokens()){
toke = (tokenizer.nextToken().trim());
this.tokenType(toke);
//System.out.println(this.tokenType(toke));
}
}
}
private BufferedReader newReader(){
try {//attempt to read the file
reader = new BufferedReader(new FileReader("Input.txt"));
}
catch(FileNotFoundException e){
System.out.println("File not found");
}
catch(IOException e){
System.out.println("I/O Exception");
}
return reader;
}
我以爲我在newReader()中處理了它,但它似乎無法訪問。 Eclipse推薦了一個拋出,但我不明白它在做什麼,或者它甚至解決了這個問題?如何正確處理這個IOException?
感謝幫助!
你在說什麼IOException,'reader.readLine()'? – home 2012-02-05 17:38:39