Int temp=0;
Try {
Fis=new FileInputStream (SRC);
Fos=new FileOutputStream (dest);
The bis=new BufferedInputStream (fis);
Bos=new BufferedOutputStream (fos);
While ((temp=bis. Read ())!=1) {
System. The out. Println (temp);
Bos. Write (temp);
}
Code snippet as shown above, this is a duplicate file operations, every time I read the middle print about the number of bytes to read, should should be 8192, that is, the the default cache array, but the output is like this:

But my own definition of cache array, no buffer flow, it is normal:

Why is this?
After I will output buffer in the flow of the temp delete statements that execution speed faster! But also far less than I used 1024 cache quickly! Is this why? (documents for around 20 MB)
CodePudding user response:
The bis. Read () reads a character at a time, so the print is the ASCII each character, inefficientCodePudding user response:
The above said is wrong, the bis. Read () reads one byte at a time,CodePudding user response:
The bis has to buffer for buffered stream, isn't it? When creating a need to set the buffer size of each time?