InputStream input stream of bytes

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class FileInputStreamDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("E:\\IO流\\java\\1.txt");
        FileInputStream f = new FileInputStream(file);
        int n = 0;
        while ((n = f.read()) != -1) {
            System.out.print((char) n);

        }
        f.close();
    }
}

 

Guess you like

Origin www.cnblogs.com/zhai1997/p/11366015.html