/** * Get the root file objects (after createDerivedFiles() ) of this tree, so that they can be * rescheduled. * * @return root objects of this unpacked tree */ List<AbstractFile> getRootFileObjects() { List<AbstractFile> ret = new ArrayList<>(); for (UnpackedNode child : rootNode.children) { ret.add(child.getFile()); } return ret; }
private void addDerivedFilesToCaseRec(UnpackedNode node, FileManager fileManager) throws TskCoreException { final String fileName = node.getFileName(); try { DerivedFile df = fileManager.addDerivedFile( fileName, node.getLocalRelPath(), node.getSize(), node.getCtime(), node.getCrtime(), node.getAtime(), node.getMtime(), node.isIsFile(), node.getParent().getFile(), "", EmbeddedFileExtractorModuleFactory.getModuleName(), "", ""); node.setFile(df); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error adding a derived file to db:" + fileName, ex); // NON-NLS throw new TskCoreException( NbBundle.getMessage( this.getClass(), "EmbeddedFileExtractorIngestModule.ArchiveExtractor.UnpackedTree.exception.msg", fileName), ex); } // recurse for (UnpackedNode child : node.children) { addDerivedFilesToCaseRec(child, fileManager); } }
/** * recursive method that traverses the path * * @param tokenPath * @return */ private UnpackedNode addNode(UnpackedNode parent, List<String> tokenPath) { // we found all of the tokens if (tokenPath.isEmpty()) { return parent; } // get the next name in the path and look it up String childName = tokenPath.remove(0); UnpackedNode child = parent.getChild(childName); // create new node if (child == null) { child = new UnpackedNode(childName, parent); } // go down one more level return addNode(child, tokenPath); }
private void getAllFileObjectsRec(List<AbstractFile> list, UnpackedNode parent) { list.add(parent.getFile()); for (UnpackedNode child : parent.children) { getAllFileObjectsRec(list, child); } }