我向文本文件寫入了數據,但文件中的數據不正確。我認爲這是OutpubStream的問題,因爲我在前面的步驟中顯示數據,並且它們是正確的。來自OutputStream(Java)的文件中的數據輸入不正確
private void Output(File file2) {
// TODO Auto-generated method stub
OutputStream os;
try {
os = new FileOutputStream(file2); //file2-it is my output file, all normal with him
Iterator<Integer> e=mass.iterator();
int r=0;
while(e.hasNext()){
r=e.next();
System.out.println(r);//display data-all be correct
os.write(r);//I think problem create in this step/
}
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
輸入數據FILE1.TXT FILE2.TXT
3 strahge tokens plus !-68DU
感謝答案
10
56
2
33
45
21
15
68
54
85
輸出數據,原諒我的英語。
我看了你的問題,大約3次,我仍然不知道什麼是所需的輸出 – 2013-04-30 16:30:39
難道是一個字節順序標記? – Fildor 2013-04-30 16:40:03