package inputDemo;
import java.io.FileInputStream;
import java.io.IOException;
/**
* FileInputStream是用来以一个字节流的形式读取一个文件,
* @author king_wang
*
*/
public class InputStreamDemo {
public static void main(String[] args) throws IOException{
FileInputStream fis=new FileInputStream("E:\\file.txt");
byte [] bytes=new byte[100];
int length=fis.read(bytes);
String str=new String(bytes,0,length);
System.out.println(str);
fis.close();
}
}
字节输入流(FileInputStream)
最新推荐文章于 2024-06-24 08:00:00 发布