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 Details

  • Method Details

    • deserializeFromBase64

      public static Map<String,​? extends Serializable> deserializeFromBase64​(String rawString) throws IOException
      Deserializes a Base64-encoded String into a HashMap. Both the keys and values must implement Serializable.
      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

      public static String serializeToBase64​(Map<String,​Serializable> map) throws 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:
      IOException - If serialization cannot be done