import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class FileInputStreamTest { public static void main(String[] args) throws IOException { //文件 File file=new File("E:\\java.txt"); //流 FileInputStream fis =new FileInputStream(file); //篮子 byte[] bytes=new byte[1024]; //计数 int temp; //循环读 while ((temp=fis.read(bytes))!=-1) { System.out.println(new String(bytes,0,temp)); } } }
文件与输入流的原理
猜你喜欢
转载自blog.csdn.net/gadxiong/article/details/79963779
今日推荐
周排行