0
我想上傳一個文件(大小爲20MB)上傳大文件,但在上傳,logcat的顯示的Android NDK:通過NDK
內存溢出異常
所以我認爲爲此使用NDK。但我不知道如何繼續。所以幫助我
static int chunkSize = 512;
static final byte[] chunks = new byte[chunkSize];
.....
......
while (true)
{
synchronized (chunks)
{
int amountRead = fileInputStream.read(chunks);
System.out.println("========amount read========="+amountRead);
if (amountRead == -1)
{
break;
}
bufferOutputStream.write(chunks, 0, amountRead);
bufferOutputStream.flush();
}
}
IAM使用「的FileInputStream」讀書「byteoutputstream」寫 – Sudarshan
那麼也許你的HTTP上傳收作方法初探加載整個字節數組到內存 –
我已經編輯我的問題,與我片段檢查have..plz和y錯誤即將到來 – Sudarshan