Class SerializationUtils

java.lang.Object
com.renomad.minum.utils.SerializationUtils

public final class SerializationUtils extends Object
  • Method Details

    • serializeHelper

      public static String serializeHelper(Object... values)
      This is a helper that will encode the values you give it in preparation for storage in a database file.

      The values will be encoded in URL-encoding (see StringUtils.encode(String)) and concatenated together with pipe-symbol "|" delimiters.

      Please note: You need to keep track of value order, and making sure all the values are accounted for.

      For example, see how this is used in Inmate.serialize()

    • deserializeHelper

      public static List<String> deserializeHelper(String serializedText)
      Splits up a string based on a pipe character. See tokenizer(String, char, int)

      This method is intended to be used as part of the database. See the package "com.renomad.minum.database"

      For an example, see how this is used in Inmate.deserialize(String)

      Parameters:
      serializedText - the string we are splitting into tokens
    • tokenizer

      public static List<String> tokenizer(String serializedText, char delimiter, int maxTokens)
      Splits up a string into tokens.
      Parameters:
      serializedText - the string we are splitting up
      delimiter - the character acting as a boundary between sections
      maxTokens - the maximum tokens allowable. Probably smart to include a number here, since otherwise you could get into some infinite loops.
      Returns:
      a list of strings. If the delimiter is not found, we will just return the whole string