class.dat

来自「21天JAVA学习! 21天JAVA学习! 21天JAVA学习!」· DAT 代码 · 共 25 行

DAT
25
字号
import java.io.*;

public class ReadBytes {
    public static void main(String[] arguments) {
        try {
            FileInputStream file = new
                FileInputStream("class.dat");
            boolean eof = false;
            int count = 0;
            while (!eof) {
                int input = file.read();
                System.out.print(input + " ");
                if (input == -1)
                    eof = true;
                else
                    count++;
            }
            file.close();
            System.out.println("\nBytes read: " + count);
        } catch (IOException e) {
            System.out.println("Error -- " + e.toString());
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?