package com.heima.io;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class D02_Fileinpustream {
/**
* @param args 输入流
* @throws IOException
*
*/
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("xxx.txt");
int a=fis.read();
System.out.println(a);
int x;
while((x=fis.read())!=-1){
System.out.println(x);
}
fis.close();
}
public static void main1(String[] args) throws IOException {
FileOutputStream fos = new FileOutputStream("yyy.txt");
fos.write(97);
fos.write(98);
fos.write(99);
fos.close();
}
} |
|