java中讲讲FileInputStream的用法,举例?

来源:互联网 发布:爱丁堡商学院申请 知乎 编辑:程序博客网 时间:2024/06/05 01:59

FileInputStream是InputStream的继承类,从字面上就可看出,它的主要功能就是能从磁盘上读入文件。read方法会一个一个字节的从磁盘往回读数据。

例:2.2.1

import java.io.*;
public class TestMark_to_win {
    public static void main(String args[]) throws Exception {
        int size;
        FileInputStream f1 = new FileInputStream("c:/1.txt");
        /*Returns the number of bytes that can be read from this file inpu

详情黏贴以下网址在地址栏后请进:

http://www.mark-to-win.com/JavaBeginner/JavaBeginner8_web.html#UsageOfFileInputStream

0 0
原创粉丝点击