import java.io.FileInputStream;
import java.io.IOException;
//读取数据
public class FileInputStream1 {
public static void main(String[] args) throws IOException {
FileInputStream stream = new FileInputStream("E:\\Workpace\\abc.txt");
int b;
while((b = stream.read()) != -1){
System.out.print((char)b);
}
stream.close();
}
}
import java.io.FileInputStream;
import java.io.IOException;
public class FileInputStream3 {
public static void main(String[] args) throws IOException {
FileInputStream inputStream = new FileInputStream("E:\\Workpace\\abc.txt");
byte[] bytes = new byte[1024];
int len;
while((len = inputStream.read(bytes)) != -1){
System.out.println(new String(bytes,0,len));
}
inputStream.close();
}
}