Package org.apache.wiki.util
Class Serializer
java.lang.Object
org.apache.wiki.util.Serializer
public final class Serializer extends Object
Provides static helper functions for serializing different objects.
- Since:
- 2.8
-
Field Summary
Fields Modifier and Type Field Description protected static String
BASE64_PREFIX
Prefix used to indicated that a serialized item was encoded with Base64. -
Method Summary
Modifier and Type Method Description static Map<String,? extends Serializable>
deserializeFromBase64(String rawString)
Deserializes a Base64-encoded String into a HashMap.static String
serializeToBase64(Map<String,Serializable> map)
Serializes a Map and formats it into a Base64-encoded String.
-
Field Details
-
BASE64_PREFIX
Prefix used to indicated that a serialized item was encoded with Base64.- See Also:
- Constant Field Values
-
-
Method Details
-
deserializeFromBase64
public static Map<String,? extends Serializable> deserializeFromBase64(String rawString) throws IOExceptionDeserializes a Base64-encoded String into a HashMap. Both the keys and values must implementSerializable
.- Parameters:
rawString
- the String contents containing the map to be deserialized- Returns:
- the attributes, parsed into a Map
- Throws:
IOException
- if the contents cannot be parsed for any reason
-
serializeToBase64
Serializes a Map and formats it into a Base64-encoded String. For ease of serialization, the Map contents are first copied into a HashMap, then serialized into a byte array that is encoded as a Base64 String.- Parameters:
map
- the Map to serialize- Returns:
- a String representing the serialized form of the Map
- Throws:
IOException
- If serialization cannot be done
-