public class ModelFileHandler
extends java.lang.Object
ModelFileHandler
class is an entry point for reading files
that contain a CognitiveModel
or
CognitiveModelFactory
objects. It handles the various file
formats that the Framework supports.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BINARY_SERIALIZED_EXTENSION
The extension for binary serialized models.
|
static java.lang.String |
CSV_EXTENSION
The extension for comma-separated-value models.
|
static java.lang.String |
XML_SERIALIZED_EXTENSION
The extension for XML serialized models.
|
Modifier | Constructor and Description |
---|---|
protected |
ModelFileHandler()
Creates a new instance of ModelIOHandler
|
Modifier and Type | Method and Description |
---|---|
static CognitiveModel |
castOrCreateModel(java.lang.Object o)
Attempts to cast the given Object to a CognitiveModel.
|
static CognitiveModel |
readModel(java.io.File file)
Attempts to read a CognitiveModel from the given file.
|
static CognitiveModel |
readModel(java.lang.String fileName)
Attempts to read a CognitiveModel from the given file name.
|
static CognitiveModel |
readModelBinarySerialized(java.io.File file)
Attempts to read a CognitiveModel from the given file in binary
serialized format.
|
static CognitiveModel |
readModelCSV(java.io.File file)
Attempts to read a CognitiveModel from the given file in CSV
format.
|
static CognitiveModelFactory |
readModelFactory(java.io.File file)
Attempts to read a CognitiveModelFactory from the given file.
|
static CognitiveModelFactory |
readModelFactory(java.lang.String fileName)
Attempts to read a CognitiveModelFactory from the given file name.
|
static CognitiveModelFactory |
readModelFactoryBinarySerialized(java.io.File file)
Attempts to read a CognitiveModelFactory from the given file in binary
serialized format.
|
static CognitiveModelFactory |
readModelFactoryCSV(java.io.File file)
Attempts to read a CognitiveModelFactory from the given file in CSV
format.
|
static CognitiveModelFactory |
readModelFactoryXMLSerialized(java.io.File file)
Attempts to read a CognitiveModelFactory from the given file in XML
serialized format.
|
static CognitiveModel |
readModelXMLSerialized(java.io.File file)
Attempts to read a CognitiveModel from the given file in XML serialized
format.
|
public static final java.lang.String BINARY_SERIALIZED_EXTENSION
public static final java.lang.String XML_SERIALIZED_EXTENSION
public static final java.lang.String CSV_EXTENSION
protected ModelFileHandler()
public static CognitiveModel readModel(java.lang.String fileName) throws java.io.IOException
fileName
- The name of the file.java.io.IOException
- If there is an IOException when reading the model.public static CognitiveModel readModel(java.io.File file) throws java.io.IOException
file
- The file.java.io.IOException
- If there is an IOException when reading the model
or if the data contained in the file is not a model.public static CognitiveModel castOrCreateModel(java.lang.Object o) throws java.io.IOException
o
- The Object to cast to a model.java.io.IOException
- If the object is not a CognitiveModel or
CognitiveModelFactory.public static CognitiveModel readModelXMLSerialized(java.io.File file) throws java.io.IOException
file
- The file.java.io.IOException
- If there is an IOException when reading the model
or if the data contained in the file is not a model.public static CognitiveModel readModelBinarySerialized(java.io.File file) throws java.io.IOException
file
- The file.java.io.IOException
- If there is an IOException when reading the model
or if the data contained in the file is not a model.public static CognitiveModel readModelCSV(java.io.File file) throws java.io.IOException
file
- The file.java.io.IOException
- If there is an IOException when reading the model
or if the data contained in the file is not a model.public static CognitiveModelFactory readModelFactory(java.lang.String fileName) throws java.io.IOException
fileName
- The file name.java.io.IOException
- If there is an IOException when reading the model
or if the data contained in the file is not a model.public static CognitiveModelFactory readModelFactory(java.io.File file) throws java.io.IOException
file
- The file.java.io.IOException
- If there is an IOException when reading the model
or if the data contained in the file is not a model.public static CognitiveModelFactory readModelFactoryXMLSerialized(java.io.File file) throws java.io.IOException
file
- The file.java.io.IOException
- If there is an IOException when reading the model
factory or if the data contained in the file is not a model
factory.public static CognitiveModelFactory readModelFactoryBinarySerialized(java.io.File file) throws java.io.IOException
file
- The file.java.io.IOException
- If there is an IOException when reading the model
factory or if the data contained in the file is not a model
factory.public static CognitiveModelFactory readModelFactoryCSV(java.io.File file) throws java.io.IOException
file
- The file.java.io.IOException
- If there is an IOException when reading the model
factory or if the data contained in the file is not a model
factory.