import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class TestFile02 {
public static void main(String[] args) throws IOException {
File f = new File("E:\\lijian\\photo\\ta\\t.txt\\t.txt");
f.createNewFile();
InputStream i = new FileInputStream(f);
byte [] b = new byte [15];
System.out.println((char)b[j]);
}
}
}
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class TestFile02 {
public static void main(String[] args) throws IOException {
File f = new File("E:\\lijian\\photo\\ta\\t.txt\\t.txt");
f.createNewFile();
InputStream i = new FileInputStream(f);
byte [] b = new byte [15];
System.out.println(i.read( b,1, 10));
//其中 b是自己定义的字节 数组,1(off)是存放在数组的下标为1的位置开始,跟从文件的哪个位置无关,文件都是从头读取
// 10(length)就是读取的字节长度
for (int j = 0; j < b.length; j++) {System.out.println((char)b[j]);
}
}
}