Increase download buffer for a SCM file (now is only 16KB) - Java Plain API
Hello everyone,
I am downloading SCM files using this:
IFileContentManager contentManager = FileSystemCore.getContentManager(teamRepository)
IFileContent onlineFileContent = file.getContent();
FileOutputStream outputStream = new FileOutputStream(localPath);
contentManager.retrieveContent(file, onlineFileContent, outputStream, monitor2);
but I noticed that the transfer data buffer is aprox. 16KB each and every time:
Transferred 15.9 KB of 210.3 KB.I tried modifying the code to work with a new buffer size:
Transferred 31.9 KB of 210.3 KB.
Transferred 47.8 KB of 210.3 KB.
Transferred 63.8 KB of 210.3 KB.
Transferred 64.0 KB of 210.3 KB.
Transferred 79.9 KB of 210.3 KB.
Transferred 95.9 KB of 210.3 KB.
The bytesRead are still in the 16KB limit even though there's more space in the buffer. For me it seems that is something from the server side, where this limit is set.IFileContentManager contentManager = FileSystemCore.getContentManager(teamRepository);
IFileContent onlineFileContent = file.getContent();
InputStream inputStream = contentManager.retrieveContentStream(file, onlineFileContent, monitor2);
int len = 50 * 1024;
byte[] dataBuffer = new byte[len];
BufferedInputStream in = new BufferedInputStream(inputStream, len);
FileOutputStream outputStream = new FileOutputStream(localPath);
int bytesRead;
while ((bytesRead = in.read(dataBuffer, 0, len)) != -1) {
outputStream.write(dataBuffer, 0, bytesRead);
outputStream.flush();
}
Do you know if it's possible to change this limit?
Thank you!
Regards,
Ana