带有缓冲的函数,通常是为了提高效率
如BufferedOutputStream,缺省可能会申请一定大小的buf(如512)
当调用函数write时并不是马上输出到OutputStream,而是先存在buf中,等到一定长度都一起输出。系统内部的缓冲你指得是什么?

解决方案 »

  1.   

    系统内部的缓冲区,是指基于操作系统IO本身就有一个缓冲,而BufferInputStream和BufferOutputStream是在内存中创建了一个缓冲,两者都没有什么所谓的区别,都是在内存中开辟了一块区域而已,只不过控制不同罢了。
      

  2.   

    另外BufferInputStream和BufferOutputStream在Java中还有一个用途:
    把输入流转换为输出流;
    或者把输出流转换为输入流。
      

  3.   

    public class BufferedInputStream
    extends FilterInputStream
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the input and to support the  and reset methods. When the BufferedInputStream is created, an internal buffer array is created. As bytes from the stream are read or skipped, the internal buffer is refilled as necessary from the contained input stream, many bytes at a time. The  operation remembers a point in the input stream and the reset operation causes all the bytes read since the most recent  operation to be reread before new bytes are taken from the contained input stream. public class BufferedOutputStream
    extends FilterOutputStream
    The class implements a buffered output stream. By setting up such an output stream, an application can write bytes to the underlying output stream without necessarily causing a call to the underlying system for each byte written. 
      

  4.   

    li_haizhou(阿土) 
    另外BufferInputStream和BufferOutputStream在Java中还有一个用途:
    把输入流转换为输出流;
    或者把输出流转换为输入流。————————————————————————————————具体是怎么转换的啊?
      

  5.   

    对不起,记错了,应该是PipedInputStream/PipedOutputStream:PipedOutputStream pos = new PipedOutputStream();
    PipedInputStream pis = new PipedInputStream(pos);
    BufferedReader br = new BufferedReader(new InputStreamReader(pis));
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(pos));bw.write("I'm artu");
    bw.close();System.out.println(br.readLine());
    br.close();