* simplify common usage

This commit is contained in:
Reinhard Pointner 2015-03-26 08:40:57 +00:00
parent 28260e51d7
commit aefa0f064a
4 changed files with 8 additions and 4 deletions

View File

@ -10,6 +10,10 @@ public class FileMapper implements ExtractOutProvider {
private File outputDir;
private boolean flatten;
public FileMapper(File outputDir) {
this(outputDir, false);
};
public FileMapper(File outputDir, boolean flatten) {
this.outputDir = outputDir;
this.flatten = flatten;

View File

@ -79,12 +79,12 @@ public class SevenZipNativeBindings implements ArchiveExtractor, Closeable {
@Override
public void extract(File outputDir) throws Exception {
extract(new FileMapper(outputDir, false));
extract(new FileMapper(outputDir));
}
@Override
public void extract(File outputDir, FileFilter filter) throws Exception {
extract(new FileMapper(outputDir, false), filter);
extract(new FileMapper(outputDir), filter);
}
public void extract(ExtractOutProvider outputMapper) throws SevenZipException {

View File

@ -1135,7 +1135,7 @@ public class CmdlineOperations implements CmdlineInterface {
}
CLILogger.info(String.format("Read archive [%s] and extract to [%s]", file.getName(), outputFolder));
final FileMapper outputMapper = new FileMapper(outputFolder, false);
final FileMapper outputMapper = new FileMapper(outputFolder);
final List<FileInfo> outputMapping = new ArrayList<FileInfo>();
for (FileInfo it : archive.listFiles()) {

View File

@ -249,7 +249,7 @@ class ExtractTool extends Tool<TableModel> {
Archive archive = Archive.open(file);
try {
final FileMapper outputMapper = new FileMapper(outputFolder, false);
final FileMapper outputMapper = new FileMapper(outputFolder);
final List<FileInfo> outputMapping = new ArrayList<FileInfo>();
for (FileInfo it : archive.listFiles()) {