testfileinputstream.java
来自「流 的目的在于屏蔽IO操作的复杂性」· Java 代码 · 共 33 行
JAVA
33 行
// 1 according fis.read(),we could get the int type data!
// 2 if we use the read(),and the file pointer move to next position!
// wangbo 2004 4 23
import java.io.*;
public class TestFileInputStream
{
public static void main(String[] args) throws Exception
{
FileInputStream fis = new FileInputStream("Test.txt");
LineNumberInputStream lnis = new LineNumberInputStream(fis);
lnis.setLineNumber(3);
System.out.println(lnis.getLineNumber());
byte[] bs = new byte[64];
fis.read(bs);
for(int i=0;i<bs.length;i++)
{
System.out.print((char)bs[i]);
}
System.out.println();
fis.close();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?