use of eu.isas.peptideshaker.utils.ExportFactoryMarshaller in project peptide-shaker by compomics.
the class PSExportFactory method saveFactory.
/**
* Saves the factory in the user folder.
*
* @param psExportFactory the instance of the factory to save
*
* @throws IOException exception thrown whenever an error occurred while
* saving the PSExportFactory
*/
public static void saveFactory(PSExportFactory psExportFactory) throws IOException {
File factoryFile = new File(JSON_FILE);
if (!factoryFile.getParentFile().exists()) {
factoryFile.getParentFile().mkdir();
}
JsonMarshaller jsonMarshaller = new ExportFactoryMarshaller();
jsonMarshaller.saveObjectToJson(psExportFactory, factoryFile);
}
use of eu.isas.peptideshaker.utils.ExportFactoryMarshaller in project peptide-shaker by compomics.
the class PSExportFactory method loadFromFile.
/**
* Loads an export factory from a file. The file must be an export of the
* factory in the json format.
*
* @param file the file to load
*
* @return the export factory saved in file
*
* @throws IOException exception thrown whenever an error occurred while
* loading the file
*/
public static PSExportFactory loadFromFile(File file) throws IOException {
JsonMarshaller jsonMarshaller = new ExportFactoryMarshaller();
PSExportFactory result = (PSExportFactory) jsonMarshaller.fromJson(PSExportFactory.class, file);
return result;
}
Aggregations