The buffer in the 1.IO stream is too small, which will cause the read incomplete (the printed things will not be all) read in will be the last read, will not cause write incomplete (that is written out of things).
2. The role of a buffer in reading is to read the contents of a file into the buffer, and then through the buffer to store, the buffer is too small will cause the printing is not complete.
Buffer in the output, as a medium, read into the buffer how much output, sequentially loop, and ultimately all printing.
3. Four ways to write:
A.
int Len;
while (((Len=fis.read ())!=-1) {
Fos.write ();
}
B.
Byte[] Byt=new byte[1024];
int Len;
while ((Len=fis.read (Byt,0,byt.length ())!=-1) {
Fos.write (Byt,0,len); No space behind, precise output
}
C.
Byte[] Byt=new byte[1024];
int Len;
while ((Len=fis.read (Byt,0,byt.length ())!=-1) {
Fos.write (Byt,0,byt.length ()); There are a lot of spaces behind, larger range
}
D.
Byte[] Byt=new byte[1024];
int Len;
while ((Len=fis.reade (byt))!=-1) {
Fos.write (BYT); There are a lot of spaces behind, larger range
}
Java:io Stream (leak filling)