import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
//虽然我们有两种方式可以读取,但是请注意,两种方式针对用一个对象在一个代码中只能使用一个,第一个读取了,后面的就不读了,因为前面的已经读完了。
public class Test {
public static void main(String[] args) throws IOException {
BufferedInputStream bis=new BufferedInputStream(new FileInputStream("bos.txt"));
int by=0;
while ((by=bis.read())!=-1){
System.out.println((char)by);
}
System.out.println("--------");
byte[] bys=new byte[1024];
int len=0;
while ((len=bis.read(bys))!=-1){
System.out.println(new String(bys,0,len));
}
bis.close();
}
}