@VisibleForTesting
  static byte[] getData(String uri) {
    /*
     * Format of a data URL:
     * data:mime/type;param=value;param=value;base64,actual_data
     * everything is optional except the actual data, which is either
     * base-64 or escaped ASCII encoded.
     */
    Preconditions.checkArgument(uri.substring(0, 5).equals("data:"));
    int commaPos = uri.indexOf(',');

    String dataStr = uri.substring(commaPos + 1, uri.length());
    if (isBase64(uri.substring(0, commaPos))) {
      return Base64.decode(dataStr, Base64.DEFAULT);
    } else {
      String str = Uri.decode(dataStr);
      Preconditions.checkNotNull(str);
      byte[] b = str.getBytes();
      return b;
    }
  }
Producer for data URIs.

<p>Data URIs embed the data in the URI itself. They don't point to a file location; the URI is
the data. Data can be encoded in either base-64 or escaped ASCII. See the <a
href="http://tools.ietf.org/html/rfc2397">spec</a> for full details.

<p>Data URIs are intended for small pieces of data only, since the URI lives on the Java heap.
For large data, use a another URI type.

<p>Charsets specified in the URI are ignored. Only UTF-8 encoding is currently supported.
imagepipeline/src/main/java/com/facebook/imagepipeline/producers/DataFetchProducer.java