import java.io.*; public class BufferedInputStreamDemo{ public static void main(String[] args)throws IOException { try { BufferedInputStream bis; int b; bis = new BufferedInputStream (new FileInputStream (new File ("D://testfile//err.log"))); try{bis.skip(10);}catch(IOException e){System.out.println(e);}System.out.println ("The content of text is:"); while ((b = bis.read()) != -1)//顺序读取文件text里的内容并赋值给整型变量b,直到文件结束为止。 { System.out.print((char)b); } bis.close(); } catch(FileNotFoundException e) { System.out.println(e); } catch(IOException e) { System.out.println(e); } }}

评论