我正在使用 BufferedOutputstream 写入方法写入文件。但它需要很长时间才能完成。我在 AIX OS 上运行了相同的代码,它工作得很好,但在 RHEL 7.6 上它不能按要求工作。Java版本是1.6
代码:
File localFile = new File(localdir,infile.getName());
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(localFile));
byte[] b = new byte[8192];
int n = 0;
while(( n = smbIn.read( b )) > 0 ) {
out.write( b, 0, n );
}
out.flush();
out.close();
smbIn.close();
out.close();
return localFile;