2020import network .aika .SuspensionHook ;
2121
2222import java .io .*;
23+ import java .nio .file .Files ;
24+ import java .nio .file .Path ;
2325import java .util .Collections ;
2426import java .util .HashMap ;
2527import java .util .Map ;
@@ -40,16 +42,17 @@ public class FSSuspensionCallbackImpl implements SuspensionHook {
4042 private Map <String , Integer > labels = Collections .synchronizedMap (new HashMap <>());
4143 private Map <Integer , long []> index = Collections .synchronizedMap (new TreeMap <>());
4244
43- private File path ;
45+ private Path path ;
4446 private String modelLabel ;
4547
4648 private RandomAccessFile dataStore ;
4749
4850
49- public void open (File path , String modelLabel , boolean create ) throws FileNotFoundException {
51+ public void open (Path path , String modelLabel , boolean create ) throws IOException {
5052 this .path = path ;
5153 this .modelLabel = modelLabel ;
5254 if (create ) {
55+ Files .createDirectories (path );
5356 File modelFile = getFile (MODEL );
5457 if (modelFile .exists ())
5558 modelFile .delete ();
@@ -148,7 +151,7 @@ public void storeIndex() {
148151 }
149152
150153 private File getFile (String prefix ) {
151- return new File (path , prefix + "-" + modelLabel + ".dat" );
154+ return new File (path . toFile () , prefix + "-" + modelLabel + ".dat" );
152155 }
153156
154157 private void readIndex (DataInput in ) throws IOException {
0 commit comments