Bug 962299 - Bundle account data into a single userdata field and add profile tracking. r=nalexander

This commit is contained in:
Richard Newman
2014-01-21 21:28:57 -08:00
parent 35ecf34691
commit a1abec2d34
5 changed files with 206 additions and 59 deletions

View File

@@ -15,6 +15,7 @@ import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.mozilla.apache.commons.codec.binary.Base64;
import org.mozilla.gecko.sync.UnexpectedJSONException.BadRequiredFieldJSONException;
/**
@@ -363,4 +364,26 @@ public class ExtendedJSONObject {
}
}
}
/**
* Return a base64-encoded string value as a byte array.
*/
public byte[] getByteArrayBase64(String key) {
String s = (String) this.object.get(key);
if (s == null) {
return null;
}
return Base64.decodeBase64(s);
}
/**
* Return a hex-encoded string value as a byte array.
*/
public byte[] getByteArrayHex(String key) {
String s = (String) this.object.get(key);
if (s == null) {
return null;
}
return Utils.hex2Byte(s);
}
}