views:

41

answers:

2

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 write 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.

+1  A: 

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.

Colin Hebert
A: 

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.

Xaqron