开发者

Out of memory Exception when converting video file

I'm converting a Video file to string using Base64 encoding.

try {
    encodedString =Base64.encodeBytes((getBytesFromFile(new File(Description.PATH))),Base64.GZIP);

} catch (IOException e) {
    e.printStackTrace();
}

When i'm converting 60 sec video, I'm getting out of memory exception..

09-30 04:52:52.322: ERROR/AndroidRuntime(29995): Caused by: java.lang.OutOfMemoryError
09-30 04:52:52.322: ERROR/AndroidRuntime(29995):     at java.nio.CharArrayBuffer.<init>(CharArrayBuffer.java:43)
09-30 04开发者_开发百科:52:52.322: ERROR/AndroidRuntime(29995):     at java.nio.ReadWriteCharArrayBuffer.<init>(ReadWriteCharArrayBuffer.java:47)
09-30 04:52:52.322: ERROR/AndroidRuntime(29995):     at java.nio.BufferFactory.newCharBuffer(BufferFactory.java:82)
09-30 04:52:52.322: ERROR/AndroidRuntime(29995):     at java.nio.CharBuffer.allocate(CharBuffer.java:53)
09-30 04:52:52.322: ERROR/AndroidRuntime(29995):     at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:214)
09-30 04:52:52.322: ERROR/AndroidRuntime(29995):     at java.nio.charset.Charset.decode(Charset.java:730)

Please let me know how to solve this issue.

Thanks in advance


I think you should use encodeToString instead of encodeBytes().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜