Hi,

I use the following code to download binary files from Artifactory:


InputStream  is         = new BufferedInputStream( new URL( downloadUrl
).openStream(), BUFFER_SIZE );
OutputStream os         = new BufferedOutputStream( new FileOutputStream(
resultFile ), BUFFER_SIZE );
byte[]       buffer     = new byte[ BUFFER_SIZE ];
int          totalBytes = 0;

for ( int bytesRead;
        (( bytesRead = is.read( buffer )) != -1 );
            os.write( buffer, 0, bytesRead ))
{
    totalBytes += bytesRead;

    if ( LOG.isDebugEnabled())
    {
        LOG.debug( String.format( "[%s] Mb read", (( float ) totalBytes / MB
)));
    }
}


"BUFFER_SIZE" is "10 * 1024 * 1024", 10Mb.
I expected to see download chunks of size close to 10Mb but here's what I
see in log:


[0.034100533] Mb read 
[0.05126667] Mb read 
[0.06843281] Mb read 
[0.085598946] Mb read 
[0.10276508] Mb read 


I.e each time I get about 10K of data even though I provide a 10Mb byte[] to
is.read( buffer )


What do you think is a problem here? Where?
Thank you!

-----
Best regards,
Evgeny
http://evgeny-goldin.com/

-- 
View this message in context: 
http://forums.jfrog.org/Chunk-size-when-downloading-binaries-from-Artifactory-tp5269022p5269022.html
Sent from the Artifactory - Users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users

Reply via email to