OutputStream OutOfMemoryError when sending HTTP

前端 未结 6 1755
深忆病人
深忆病人 2020-12-01 16:53

I am trying to publish a large video/image file from the local file system to an http path, but I run into an out of memory error after some time...

here is the code

6条回答
  •  青春惊慌失措
    2020-12-01 17:23

    HttpsURLConnection#setChunkedStreamingMode(1024 * 1024 * 10); //10MB chunk This ensures that any file (of any size) is streamed over a https connection, without internal buffering. This should be used when the file size or the content length is unknown.

提交回复
热议问题