base64 encoding .txt file

ardonis:
...
i think that's because of limited ram.
...
Here is the code:

...

String b = "";
...
                  b += aChar;
...

Concatenating one character at a time like this, into a String object, is almost certainly going to use up all your RAM. Try another method.