我已經創建了一個帶有printStream對象的文件,如下所示。java中的令牌解析
PrintStream outPutOffice = new PrintStream(
new BufferedOutputStream(new FileOutputStream(inDir+"/Office.txt")));
outPutOffice.print(fValue + (findx < agtOffColCount ? "|" : ""));
現在我必須閱讀它的內容並用「|」分隔它的標記。因爲我用「|」寫了標記分離。我已經編寫了如下所示的代碼,它將正確讀取行,但不會將單獨的標記與「|」字符。
BufferedReader inPutAgent = new BufferedReader(
new InputStreamReader(new FileInputStream(inDir+"/Office.txt")));
String column=inPutAgent.readLine();
String []columnDetail = column.split("|");
columndetail數組在每個索引中包含單個字符,而是我想在每個索引中使用單個標記。
什麼問題?
您可能還希望瞭解,一個作家和OutputStream的之間的區別是什麼。看看FileWriter API http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileWriter.html – 2009-10-27 11:17:54