java.io.IOException: Value too large for defined data type
将将近 2.1GB 的大文件上传到服务器时,我得到了一个。我的代码是:
URL oUrl = new URL(servierUrl);
HttpURLConnection connection = (HttpURLConnection) oUrl.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Connection", "Keep-Alive");
connection.setRequestProperty("Content-Type", "multipart/form- data");
connection.setRequestProperty("Content-Length", String.valueOf(nChunkSize));
connection.setConnectTimeout(1800000);
InputStream oFileInputStream = new FileInputStream(new File(sFilePath));
OutputStream outputStream = new DataOutputStream(connection.getOutputStream());
.
.
. // here I'm dividing the stream chunks, every chunk 5Mb and uploading the chuck to server
but in the chunk #410 (5Mb * 410) it cause an exception return the exception as I mentioned above.
before that every chunk I upload it success
.
.
所以请提供任何帮助。