package IO;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class FileinputstremTest {
public static void main(String[] args) {
FileInuputStream fis =null;
try(
fis =new FileInputStream("C:\\\\Users\\\\Administrator\\\\Desktop\\\\ZR.txt");
StringBuffer sbff =new StringBuffer();
int next=0;
while((next=fis.read( ))!=-1){
sbff,append((char) next);
}
System.out.println(sbff);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
fis.close();
catch (IOException e) {
e.printStackTrace();
}
}
}
}
时间: 2024-10-31 23:15:35