I am copying a large file 300 MB from client to server. I have both the client and server (weblogic) setup locally and still the transfer is too slow. Is there anyway to speed it up only when I have the server on same machine as the client? Here is the code I am using:
boolean decodeStream = false;
bytesRead = istream.read(buffer, 0, BUFFER_SIZE);
if (bytesRead != -1 && Base64.isArrayByteBase64(buffer))
{
decodeStream = true;
}
istream.close();
//write the file to the file specified
// if createFile then create a new file
// otherwise append.
OutputStream bos = new FileOutputStream(fileNamePath, !createFile); // second parameter, if true then append...
istream = file.getInputStream();
if (decodeStream)
{
// File is encoded, decode it.
Logger.log("(perform) Decoding file: " + fileNamePath, _moduleName, Logger.DEBUG);
// Stream came in encoded, so we need to decode it.
Base64.InputStream stream = new Base64.InputStream(istream);
while ((bytesRead = stream.read(buffer, 0, BUFFER_SIZE)) != -1)
{
bos.write(buffer, 0, bytesRead);
}
stream.close();
}
else
{
// File is not encoded.
while ((bytesRead = istream.read(buffer, 0, BUFFER_SIZE)) != -1)
{
bos.write(buffer, 0, bytesRead);
}
}