java.lang.Object
com.renomad.minum.utils.SerializationUtils
-
Method Summary
Modifier and TypeMethodDescriptiondeserializeHelper
(String serializedText) Splits up a string based on a pipe character.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.Splits up a string into tokens.
-
Method Details
-
serializeHelper
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
Splits up a string based on a pipe character. Seetokenizer(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
Splits up a string into tokens.- Parameters:
serializedText
- the string we are splitting updelimiter
- the character acting as a boundary between sectionsmaxTokens
- 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
-