19 package org.sleuthkit.autopsy.modules.interestingitems;
22 import java.io.FileInputStream;
23 import java.io.FileOutputStream;
24 import java.io.IOException;
25 import java.io.Serializable;
26 import java.nio.file.Path;
27 import java.nio.file.Paths;
28 import java.util.HashMap;
30 import org.openide.util.io.NbObjectInputStream;
31 import org.openide.util.io.NbObjectOutputStream;
37 class FileSetsDefinitions
implements Serializable {
40 private static final long serialVersionUID = 1L;
42 private final Map<String, FilesSet> filesSets;
44 FileSetsDefinitions(Map<String, FilesSet> filesSets) {
45 this.filesSets = filesSets;
51 Map<String, FilesSet> getFilesSets() {
64 out.writeObject(
new FileSetsDefinitions(interestingFilesSets));
65 }
catch (IOException ex) {
81 File fileSetFile = filePath.toFile();
82 String filePathStr = filePath.toString();
83 if (fileSetFile.exists()) {
85 try (
final NbObjectInputStream in =
new NbObjectInputStream(
new FileInputStream(filePathStr))) {
86 FileSetsDefinitions filesSetsSettings = (FileSetsDefinitions) in.readObject();
87 return filesSetsSettings.getFilesSets();
89 }
catch (IOException | ClassNotFoundException ex) {
93 return new HashMap<>();