Skip to content

Commit

Permalink
Updating fileops.Unzip
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Jun 6, 2022
1 parent 8135f84 commit c015521
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/main/java/org/luwrain/app/commander/fileops/Unzip.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@
import java.nio.file.*;
import java.util.*;

import org.apache.commons.compress.archivers.zip.*;


import org.luwrain.core.*;
import org.luwrain.app.commander.*;
import org.luwrain.util.*;

public final class Unzip extends Operation
{
static private final String
CHARSET = "cp866";

private final Path zipFile;
private final Path destDir;

Expand All @@ -38,9 +44,19 @@ public Unzip(OperationListener listener, String name, Path zipFile, Path destDir
this.destDir = destDir;
}

@Override public void work() throws IOException
{
}
@Override public void work() throws IOException
{
try (final ZipFile zipFile = new ZipFile(this.zipFile.toFile(), CHARSET, false)) {
final Enumeration enumEntry = zipFile.getEntries();
while(enumEntry.hasMoreElements())
{
final ZipArchiveEntry entry = (ZipArchiveEntry) enumEntry.nextElement();
try (final InputStream is = zipFile.getInputStream(entry)) {
//handler.onZippedFile(entry.getName(), is);
}
}
}
}

@Override public int getPercent()
{
Expand Down

0 comments on commit c015521

Please sign in to comment.