FileInputStream fin = new FileInputStream("D:\\testout.txt");
BufferedInputStream bin = new BufferedInputStream(fin);
int i;
while((i = bin.read())!=-1) {
System.out.print((char)i);
}
bin.close();
fin.close();
出力:私は、ファイルtestout.txtをチェックしてÿþGreat
Javaでファイルの読み取り中に、入力が2つのジャンク文字
は、それだけで一つの単語すなわち、Great
が含まれています。
出力には2つの追加文字が含まれています - >>ÿþGreat。 –
入出力の例を教えてください。 – magicleon
[ファイルの内容からJava文字列を作成するにはどうすればいいですか?](https://stackoverflow.com/questions/326390/how-do-i-create-a-java-string-from-the -contents-of-a-file) –