public class PropertiesSerializer
extends java.lang.Object
Constructor and Description |
---|
PropertiesSerializer() |
Modifier and Type | Method and Description |
---|---|
static Dict |
read(java.io.File file)
Reads a file containing properties and returns the contents
in a dictionary.
|
static Dict |
read(java.util.zip.ZipFile zip,
java.util.zip.ZipEntry entry)
Reads a ZIP file entry containing properties and returns the
contents in a dictionary.
|
static java.lang.String |
serialize(java.lang.Object obj)
Serializes an object into an properties representation.
|
static java.util.Properties |
toProperties(Dict dict)
Converts a dictionary into a properties object.
|
static void |
write(java.io.File file,
Dict dict)
Writes the contents of a dictionary into a properties file.
|
public static java.lang.String serialize(java.lang.Object obj) throws java.io.IOException
obj
- the object to convert, or nulljava.io.IOException
- if the data couldn't be serializedpublic static Dict read(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
file
- the file to loadjava.io.FileNotFoundException
- if the file couldn't be foundjava.io.IOException
- if an error occurred while reading the
filepublic static Dict read(java.util.zip.ZipFile zip, java.util.zip.ZipEntry entry) throws java.io.IOException
zip
- the ZIP fileentry
- the ZIP file entry to loadjava.io.IOException
- if an error occurred while reading the
filepublic static void write(java.io.File file, Dict dict) throws java.io.IOException
file
- the file to savedict
- the dictionary objectjava.io.IOException
- if an error occurred while writing the
filepublic static java.util.Properties toProperties(Dict dict)
dict
- the dictionary object