I have a web application that is deployed using WildFly server 9.x in azure server.
I am moving files using inputstream to outputstream.
while copying files I am having the IOException while uploading the very large file (45 GB).
Caused by: java.io.IOException: Invalid argument
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:255)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at org.apache.commons.vfs2.util.MonitorInputStream.read(MonitorInputStream.java:99)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
pseudo code :
byte[] baBuf = new byte[bufferSize];
while ((int iLen = is.read(baBuf)) >= 0) {
os.write(baBuf, 0, iLen);
size += iLen;
}
where we had taken specific buffersize of 1048576 (1024 * 1024)
is : InputStream
os : OutputStream
This code is working for the small files.