|
Message Security Layer (MSL) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.netflix.msl.util.JsonUtils
public class JsonUtils
JSON processing utility functions.
| Field Summary | |
|---|---|
private static char |
CHAR_EQUALS
|
private static char |
CHAR_MINUS
|
private static char |
CHAR_PLUS
Base64 characters. |
private static char |
CHAR_SLASH
|
private static char |
CHAR_UNDERSCORE
|
private static Charset |
UTF_8
Encoding charset. |
| Constructor Summary | |
|---|---|
JsonUtils()
|
|
| Method Summary | |
|---|---|
static byte[] |
b64urlDecode(String data)
URL-safe Base64 decode data that has no padding characters. |
static String |
b64urlDecodeToString(String data)
URL-safe Base64 decode data as UTF-8 that has no padding characters. |
static String |
b64urlEncode(byte[] data)
URL-safe Base64 encode data without padding characters. |
static String |
b64urlEncode(String s)
URL-safe Base64 encode data as UTF-8 without padding characters. |
static JSONArray |
createArray(Collection<?> c)
Create a JSON array from a collection of objects that are either one of the accepted types: Boolean, JSONArray,
JSONObject, Number, String, or
the JSONObject.NULL object or turn any
JSONString into a JSONObject. |
static boolean |
equals(JSONArray ja1,
JSONArray ja2)
Performs a deep comparison of two JSON arrays for equality. |
static boolean |
equals(JSONObject jo1,
JSONObject jo2)
Performs a deep comparison of two JSON objects for equivalence. |
static boolean |
equalSets(JSONArray ja1,
JSONArray ja2)
Performs a shallow comparison of two JSON arrays for set equality. |
static boolean |
objectEquals(String js1,
String js2)
Performs a deep comparison of two JSON objects. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final Charset UTF_8
private static final char CHAR_PLUS
private static final char CHAR_MINUS
private static final char CHAR_SLASH
private static final char CHAR_UNDERSCORE
private static final char CHAR_EQUALS
| Constructor Detail |
|---|
public JsonUtils()
| Method Detail |
|---|
public static String b64urlEncode(String s)
s - the value to Base64 encode.
public static String b64urlEncode(byte[] data)
data - the value to Base64 encode.
public static byte[] b64urlDecode(String data)
data - the Base64 encoded data.
null if there is an error decoding.public static String b64urlDecodeToString(String data)
data - the Base64 encoded data.
public static JSONArray createArray(Collection<?> c)
throws JSONException
Boolean, JSONArray,
JSONObject, Number, String, or
the JSONObject.NULL object or turn any
JSONString into a JSONObject.
c - a collection of JSON-compatible objects.
JSONException - if a JSONString cannot be encoded
properly or an unsupported object is encountered.
public static boolean objectEquals(String js1,
String js2)
throws JSONException
js1 - first JSON object string representation.js2 - second JSON object string representation.
JSONException - if there is an error parsing the JSON.equals(JSONObject, JSONObject)
public static boolean equals(JSONObject jo1,
JSONObject jo2)
throws JSONException
jo1 - first JSON object.jo2 - second JSON object.
JSONException - if there is an error parsing the JSON.
public static boolean equals(JSONArray ja1,
JSONArray ja2)
throws JSONException
ja1 - first JSON array. May be null.ja2 - second JSON array. May be null.
JSONException - if there is an error parsing the JSON.
public static boolean equalSets(JSONArray ja1,
JSONArray ja2)
throws JSONException
ja1 - first JSON array. May be null.ja2 - second JSON array. May be null.
JSONException - if there is an error parsing the JSON.
|
Message Security Layer (MSL) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||