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
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
BASE64_PREFIX
Prefix used to indicated that a serialized item was encoded with Base64. -
Method Summary
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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 java.util.Map<java.lang.String,? extends java.io.Serializable> deserializeFromBase64(java.lang.String rawString) throws java.io.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:
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.IOExceptionSerializes 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
-