binfileinput.java
来自「《Java核心技术应用开发》电子工业出版社书籍源代码」· Java 代码 · 共 27 行
JAVA
27 行
package sample;
import java.io.*;
public class BinFileInput {
public static void main(String f[]) {
FileInputStream fis;
DataInputStream dis;
try {
fis = new FileInputStream(f[0]);
// Wrap with a DataInputStream so that we can
// use its readInt() method.
dis = new DataInputStream( fis );
System.out.println( "file: " + f[0] );
int i;
while ( true ) {
i = dis.readInt();
System.out.println( "read: " + i );
}
} catch (EOFException eof)
{System.out.println( "EOF reached " ); }
catch (IOException ioe)
{System.out.println( "IO error: " + ioe );}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?