自己在学IO的时候看到BufferedInputStream的时候,BufferedInputStream bis = new BufferedInputStream(new FileInputStream("f:/src/TestBuffer1.java"));然后调用bis.(100)方法,发现方法在这没什么作用,然后在论坛上看到,有大大解释说对于 FileInputStream.无实现,即继承了InputStream的缺省实现。不支持,自然方法里的参数也无关痛痒,知道了为什么没作用。
       但是如果BufferedReader br = new BufferedReader(new FileReader("f:/src/TestBuffer1.java")),调用br.readLine()方法为什么能用?

解决方案 »

  1.   

    你问的很有意思,首先这是两个方法,其次,一个是字节流,一个是字符流,readLine是读取一行数据,也就按换行符来算的,字节流是不会以“行”来计算的。
      

  2.   

    我知道这是两个方法,一个是字节,一个字符,我的意思是这两个方法在各自的类中,都差不多,为什么能用,而readline却能用
      

  3.   

    看API 看原码,看原码是最好的方法
      

  4.   

    Supportedpublic boolean Supported()

    Tests if this input stream supports the  and reset methods. Whether or not  and reset are supported is an invariant property of a particular input stream instance. The Supported method of InputStream returns false.
    Returns:
        true if this stream instance supports the  and reset methods; false otherwise.