Package google.registry.util
Class SerializeUtils
java.lang.Object
google.registry.util.SerializeUtils
Utilities for easy serialization with informative error messages.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
decodeBase64
(String objectString) Turns a string encoded byencodeBase64(byte[])
back into a byte array.static <T> T
deserialize
(Class<T> type, byte[] objectBytes) Turns a byte string into an object.static String
encodeBase64
(byte[] bytes) Encodes a byte array as a URL-safe string.static <T> T
Turns a string encoded by stringify() into an object.static byte[]
Turns an object into a byte array.static Object
serializeDeserialize
(Object object) Serializes an object then deserializes it.static String
stringify
(Serializable object) Turns an object into an encoded string that can be used safely as a URI query parameter.
-
Method Details
-
serialize
Turns an object into a byte array.- Returns:
- serialized object or
null
ifvalue
isnull
-
deserialize
Turns a byte string into an object.- Returns:
- deserialized object or
null
ifobjectBytes
isnull
-
serializeDeserialize
Serializes an object then deserializes it. This is typically used in tests. -
encodeBase64
Encodes a byte array as a URL-safe string. -
decodeBase64
Turns a string encoded byencodeBase64(byte[])
back into a byte array. -
stringify
Turns an object into an encoded string that can be used safely as a URI query parameter. -
parse
Turns a string encoded by stringify() into an object.
-