开发者

Download file in base64 efficiently

I have to download an arbitrarily large file in base64 in a device with limited RAM memory in Java.

How do I download a file in base64 efficiently? Is it possible to get sequential chunks of base64 and writ开发者_开发技巧e them to the output as binary data?

A code or pseudo-code example would be much appreciated.

Note: I can't use external frameworks, but I have base64 decode and encode functions.


You could use a stream to decode the base64.

You can use the common codec library, but if you don't want to use an external library, you could use this code as an example.


Open two streams. One to remote file, another to a local file. Download remote file into a buffer and pass the buffer to other stream for writing to the local file.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜