import java.io.*; |
/** |
* 阅读流的原始字节数据,如图像数据。 |
* |
*/ |
public class FileInputDemo { |
public static void main(String args[]) { |
if (args.length == 1 ) { |
try { |
FileInputStream fstream = new FileInputStream(args[ 0 ]); |
DataInputStream in = new DataInputStream(fstream); |
while (in.available() != 0 ) { |
System.out.println(String.valueOf(in.readDouble())); // in的readDouble()方法 |
} |
in.close(); |
} catch (Exception e) { |
System.out.println( "文件输入错误" ); |
} |
} else |
System.out.println( "参数无效" ); |
} |
} |