private int mapCharToInt(Reader input) throws IOException {
    int c;
    while ((c = input.read()) != -1) {
      int result = REVERSE_MAPPING[c];
      if (result != 0) return result - 1;
      if (c == '=') return -1;
    }
    return -1;
  }
Encodes binary data to plain text as Base64.

<p>
Despite there being a gazillion other Base64 implementations out there, this has been written as
part of XStream as it forms a core part but is too trivial to warrant an extra dependency.
</p>

<p>
This meets the standard as described in RFC 1521, section 5.2
<http://www.freesoft.org/CIE/RFC/1521/7.htm>, allowing other Base64 tools to manipulate the data.
</p>

Original code from <a href="http://xstream.codehaus.org/">XStream</a>
selendroid-server/src/main/java/io/selendroid/server/android/internal/Base64Encoder.java