我正在进行文件操作(文件从一个位置复制到另一个位置)。 当文件大小小于2GB时,复制工作正常。但是,如果不止于此,请给予
<BEA-000449> <Closing socket as no data read from it on ***.***.***.***:port_no, during the configured idle timeout of 5 secs>
代码如下,
private void copyFile(InputStream uploadedInputStream,
String uploadedFileLocation, boolean append) {
File publicFile;
OutputStream out = null;
try {
publicFile=new File(uploadedFileLocation);
out = new FileOutputStream(publicFile,append);
int read;
byte[] bytes = new byte[1024];
while ((read = uploadedInputStream.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
out.flush();
} catch (IOException e) {
System.out.println("Exception in transfering file" +e.getMessage());
}finally
{
try{
if(out!=null)out.close();
}catch (IOException e) {
e.printStackTrace();
}
}
我在浏览后得到的解决方案是调整服务器。还有其他方法可以让它发挥作用吗?