我在我的项目中使用 milton 服务器来支持 webdav 协议,但是有一个问题。这是我的上传(PUT)方法代码:
public DavFile upload(InputStream is, String name) {
DavFile davFile = null;
if (is != null) {
File newFile = new File(name);
BufferedOutputStream os = null;
byte[] buffer = new byte[1024 * 1024];
int size;
try {
os = new BufferedOutputStream(new FileOutputStream(newFile, false), buffer.length);
while ((size = is.read(buffer)) > 0) {
System.out.println("Log: " + name + " | " + size);
os.write(buffer, 0, size);
}
Util.closeOutputStream(os);
davFile = new DavFile(newFilePath);
} catch (Exception ex) {
Util.writeLog(ex);
} finally {
Util.closeInputStream(is);
Util.closeOutputStream(os);
}
}
return davFile;
}
这是输出:
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 7834
Log: 722267_119335884931029_2021941220_n.mp4 | 3145
如何增加 milton 服务器中 InputStream 的读取大小?我无法将 InputStream 更改为任何其他类型,例如 BufferedInputStream!
在我的本地计算机上,上传速度是 27KB/s,这太慢了!!!