public class SerializedModelHandler
extends java.lang.Object
SerializedModelHandler
class implements some utility
methods for dealing with models that have been serialized using the Java
serialization API.Modifier | Constructor and Description |
---|---|
protected |
SerializedModelHandler()
Creates a new instance of SerializedModelHandler
|
Modifier and Type | Method and Description |
---|---|
static CognitiveModel |
readModelFromFile(java.io.File file)
Reads a serialized CognitiveModel from the given file.
|
static CognitiveModel |
readModelFromFile(java.lang.String fileName)
Reads a serialized CognitiveModel from the given file.
|
static java.lang.Object |
readObjectFromFile(java.io.File file)
Reads a serialized Java Object from the given File.
|
static void |
writeModelToFile(java.io.File file,
CognitiveModel model)
Writes the given CognitiveModel to the given file using Java object
serialization
|
static void |
writeModelToFile(java.lang.String fileName,
CognitiveModel model)
Writes the given CognitiveModel to the given file using Java object
serialization
|
protected SerializedModelHandler()
public static java.lang.Object readObjectFromFile(java.io.File file) throws java.io.FileNotFoundException, java.lang.ClassNotFoundException, java.io.IOException
file
- The File to read from.java.io.FileNotFoundException
- If the file was not found.java.lang.ClassNotFoundException
- If the class that the Object or
one of its internal fields cannot be found.java.io.IOException
- If there is any other type of error reading from
the file.public static CognitiveModel readModelFromFile(java.lang.String fileName) throws java.io.FileNotFoundException, java.lang.ClassNotFoundException, java.io.IOException
fileName
- The name of the file to read from.java.io.FileNotFoundException
- If the file was not found.java.lang.ClassNotFoundException
- If a class in the file cannot be found.java.io.IOException
- If there is any other type of error reading from
the file.public static CognitiveModel readModelFromFile(java.io.File file) throws java.io.FileNotFoundException, java.lang.ClassNotFoundException, java.io.IOException
file
- The file to read from.java.io.FileNotFoundException
- If the file was not found.java.lang.ClassNotFoundException
- If a class in the file cannot be found.java.io.IOException
- If there is any other type of error reading from
the file.public static void writeModelToFile(java.lang.String fileName, CognitiveModel model) throws java.io.IOException
fileName
- The name of the file to write to.model
- The model to serialize into the file.java.io.IOException
- If there was an error writing the object.public static void writeModelToFile(java.io.File file, CognitiveModel model) throws java.io.IOException
file
- The File to write to.model
- The model to serialize into the file.java.io.IOException
- If there was an error writing the object.