Package org.apache.wiki.util
Class Serializer
- java.lang.Object
-
- org.apache.wiki.util.Serializer
-
public final class Serializer extends java.lang.Object
Provides static helper functions for serializing different objects.- Since:
- 2.8
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,? extends java.io.Serializable>
deserializeFromBase64(java.lang.String rawString)
Deserializes a Base64-encoded String into a HashMap.static java.lang.String
serializeToBase64(java.util.Map<java.lang.String,java.io.Serializable> map)
Serializes a Map and formats it into a Base64-encoded String.
-
-
-
Method Detail
-
deserializeFromBase64
public static java.util.Map<java.lang.String,? extends java.io.Serializable> deserializeFromBase64(java.lang.String rawString) throws java.io.IOException
Deserializes 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:
java.io.IOException
- if the contents cannot be parsed for any reason
-
serializeToBase64
public static java.lang.String serializeToBase64(java.util.Map<java.lang.String,java.io.Serializable> map) throws java.io.IOException
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:
java.io.IOException
- If serialization cannot be done
-
-