更新时间:2023-01-06 07:51:52
复制a的规范方法Java中的流:
The canonical way to copy a stream in Java:
int count;
byte[] buffer = new byte[8192];
while ((count = in.read(buffer)) > 0)
{
out.write(buffer, 0, count);
}
适用于任何大于零的缓冲区大小。应该尽量避免将缓冲区大小与输入大小联系起来的诱惑。
Works with any buffer size greater than zero. The temptation to relate the buffer size to the input size should be strenuously avoided.