* simplify common usage
This commit is contained in:
parent
28260e51d7
commit
aefa0f064a
|
@ -10,6 +10,10 @@ public class FileMapper implements ExtractOutProvider {
|
||||||
private File outputDir;
|
private File outputDir;
|
||||||
private boolean flatten;
|
private boolean flatten;
|
||||||
|
|
||||||
|
public FileMapper(File outputDir) {
|
||||||
|
this(outputDir, false);
|
||||||
|
};
|
||||||
|
|
||||||
public FileMapper(File outputDir, boolean flatten) {
|
public FileMapper(File outputDir, boolean flatten) {
|
||||||
this.outputDir = outputDir;
|
this.outputDir = outputDir;
|
||||||
this.flatten = flatten;
|
this.flatten = flatten;
|
||||||
|
|
|
@ -79,12 +79,12 @@ public class SevenZipNativeBindings implements ArchiveExtractor, Closeable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void extract(File outputDir) throws Exception {
|
public void extract(File outputDir) throws Exception {
|
||||||
extract(new FileMapper(outputDir, false));
|
extract(new FileMapper(outputDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void extract(File outputDir, FileFilter filter) throws Exception {
|
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 {
|
public void extract(ExtractOutProvider outputMapper) throws SevenZipException {
|
||||||
|
|
|
@ -1135,7 +1135,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
CLILogger.info(String.format("Read archive [%s] and extract to [%s]", file.getName(), outputFolder));
|
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>();
|
final List<FileInfo> outputMapping = new ArrayList<FileInfo>();
|
||||||
for (FileInfo it : archive.listFiles()) {
|
for (FileInfo it : archive.listFiles()) {
|
||||||
|
|
|
@ -249,7 +249,7 @@ class ExtractTool extends Tool<TableModel> {
|
||||||
|
|
||||||
Archive archive = Archive.open(file);
|
Archive archive = Archive.open(file);
|
||||||
try {
|
try {
|
||||||
final FileMapper outputMapper = new FileMapper(outputFolder, false);
|
final FileMapper outputMapper = new FileMapper(outputFolder);
|
||||||
|
|
||||||
final List<FileInfo> outputMapping = new ArrayList<FileInfo>();
|
final List<FileInfo> outputMapping = new ArrayList<FileInfo>();
|
||||||
for (FileInfo it : archive.listFiles()) {
|
for (FileInfo it : archive.listFiles()) {
|
||||||
|
|
Loading…
Reference in New Issue