Commit 9cb5fb58 authored by Chris Coughlin's avatar Chris Coughlin

ROIFinder serialization tweak

parent 465e9069
......@@ -230,7 +230,7 @@ public class PassiveAggressiveROIFinder implements MLROIFinder {
setNumFeatures(model.numFeatures());
setNumCategories(model.numCategories());
} catch (IOException ioe) {
log.error("Error writing model: " + ioe.getMessage());
log.error("Error reading model: " + ioe.getMessage());
}
}
}
......@@ -38,6 +38,7 @@ public interface ROIFinder extends KryoSerializable {
default void save(File outFile) throws IOException {
Kryo kryo = new Kryo();
Output output = new Output(new FileOutputStream(outFile));
kryo.writeObject(output, this.getClass().toString());
write(kryo, output);
output.close();
}
......@@ -50,6 +51,10 @@ public interface ROIFinder extends KryoSerializable {
default void load(File inFile) throws IOException {
Kryo kryo = new Kryo();
Input input = new Input(new FileInputStream(inFile));
String clz = kryo.readObject(input, String.class);
if (!this.getClass().toString().equals(clz)) {
throw new IOException("Unrecognized class " + clz);
}
read(kryo, input);
input.close();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment