BufferedOutputStream write method taking too long

147 Views Asked by At

I am using BufferedOutputstream write method to write to a file. But it is taking ages to complete. I have same code running on AIX OS and its working just fine, but on RHEL 7.6 its not working as required. Java version is 1.6

Code:

    File localFile = new File(localdir,infile.getName());

    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(localFile));

    byte[] b = new byte[8192];
    int n = 0;


    while(( n = smbIn.read( b )) > 0 ) {

        out.write( b, 0, n );
    }

    out.flush();
    out.close();

    smbIn.close();
    out.close();

    return localFile;
0

There are 0 best solutions below