diff --git a/iped-carvers/iped-carvers-impl/src/main/java/iped/carvers/custom/ResumeDatCarver.java b/iped-carvers/iped-carvers-impl/src/main/java/iped/carvers/custom/ResumeDatCarver.java index 8d9ab1b3f3..fcc912a7fc 100644 --- a/iped-carvers/iped-carvers-impl/src/main/java/iped/carvers/custom/ResumeDatCarver.java +++ b/iped-carvers/iped-carvers-impl/src/main/java/iped/carvers/custom/ResumeDatCarver.java @@ -3,6 +3,7 @@ import java.util.Map; public class ResumeDatCarver extends TorrentCarver { + @Override public boolean isValid(Map dict) { for (String key : dict.keySet()) { Object value = dict.get(key); @@ -16,4 +17,14 @@ public boolean isValid(Map dict) { } return false; } + + @Override + protected String getCarvedNamePrefix() { + return "Carved-Resume-"; + } + + @Override + protected String getCarvedNameSuffix() { + return ".dat"; + } } diff --git a/iped-carvers/iped-carvers-impl/src/main/java/iped/carvers/standard/AbstractCarver.java b/iped-carvers/iped-carvers-impl/src/main/java/iped/carvers/standard/AbstractCarver.java index 329e87be8f..b8c46da774 100644 --- a/iped-carvers/iped-carvers-impl/src/main/java/iped/carvers/standard/AbstractCarver.java +++ b/iped-carvers/iped-carvers-impl/src/main/java/iped/carvers/standard/AbstractCarver.java @@ -17,7 +17,6 @@ import iped.properties.MediaTypes; public abstract class AbstractCarver implements Carver { - protected static String carvedNamePrefix = "Carved-";// esta propriedade não foi declarada estatica para permitir protected CarverType[] carverTypes = null; protected ArrayDeque headersWaitingFooters = new ArrayDeque<>(); @@ -99,7 +98,7 @@ public IItem carveFromHeader(IItem parentEvidence, Hit header, long len) throws if ((!ignoreCorrupted && !isSpecificIgnoreCorrupted()) || isValid(parentEvidence, header, len)) { IItem offsetFile = parentEvidence.createChildItem(); - String name = carvedNamePrefix + header.getOffset(); + String name = getCarvedNamePrefix() + header.getOffset() + getCarvedNameSuffix(); offsetFile.setName(name); offsetFile.setPath(parentEvidence.getPath() + ">>" + name); @@ -150,7 +149,23 @@ public IItem carveFromFooter(IItem parentEvidence, Hit footer) throws IOExceptio return null; } + + /** + * @return The prefix to be used in carved item name. Use a function to allow + * overriding. + */ + protected String getCarvedNamePrefix() { + return "Carved-"; + } + /** + * @return The suffix to be used in carved item name. Default is an empty + * string. + */ + protected String getCarvedNameSuffix() { + return ""; + } + public boolean isValid(IItem parentEvidence, Hit headerOffset, long length) { try { // tenta parsear o conteudo