String header = href.substring(0, commaPos);
String data = href.substring(commaPos + 1);
if (header.endsWith(";base64")) {
byte[] bytes = data.getBytes();
ByteArrayInputStream encodedStream = new ByteArrayInputStream(bytes);
Base64DecodeStream decodedStream = new Base64DecodeStream(encodedStream);
return new StreamSource(decodedStream);
} else {
//Note that this is not quite the full story here. But since we are only interested
//in base64-encoded binary data, the next line will probably never be called.
return new StreamSource(new java.io.StringReader(data));