It's all about the answers!

Ask a question

Increase download buffer for a SCM file (now is only 16KB) - Java Plain API

Ana-Maria Rosu (489) | asked Mar 24 '22, 3:54 a.m.
edited Mar 24 '22, 3:58 a.m.

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.
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.
I tried modifying the code to work with a new buffer size:

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 =, 0, len)) != -1) {

outputStream.write(dataBuffer, 0, bytesRead);



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. 
Do you know if it's possible to change this limit?

Thank you!


Be the first one to answer this question!

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.