This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push: new 957269209 Small internal refactoring 957269209 is described below commit 95726920949076f22cd5a76016c05648adecea84 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu Feb 1 17:18:52 2024 -0500 Small internal refactoring Normalize spelling --- .../apache/commons/compress/archivers/Lister.java | 42 ++++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/Lister.java b/src/main/java/org/apache/commons/compress/archivers/Lister.java index 856402865..f987856e0 100644 --- a/src/main/java/org/apache/commons/compress/archivers/Lister.java +++ b/src/main/java/org/apache/commons/compress/archivers/Lister.java @@ -62,6 +62,28 @@ public final class Lister { } } + private static void list(final Path file, final String... args) throws ArchiveException, IOException { + println("Analyzing " + file); + if (!Files.isRegularFile(file)) { + System.err.println(file + " doesn't exist or is a directory"); + } + final String format = (args.length > 1 ? args[1] : detectFormat(file)).toLowerCase(Locale.ROOT); + println("Detected format " + format); + switch (format) { + case ArchiveStreamFactory.SEVEN_Z: + list7z(file); + break; + case ArchiveStreamFactory.ZIP: + listZipUsingZipFile(file); + break; + case ArchiveStreamFactory.TAR: + listZipUsingTarFile(file); + break; + default: + listStream(file, args); + } + } + private static void list7z(final Path file) throws IOException { try (SevenZFile sevenZFile = SevenZFile.builder().setPath(file).get()) { println("Created " + sevenZFile); @@ -118,26 +140,8 @@ public final class Lister { return; } Objects.requireNonNull(args[0], "args[0]"); - println("Analysing " + args[0]); final Path file = Paths.get(args[0]); - if (!Files.isRegularFile(file)) { - System.err.println(file + " doesn't exist or is a directory"); - } - final String format = (args.length > 1 ? args[1] : detectFormat(file)).toLowerCase(Locale.ROOT); - println("Detected format " + format); - switch (format) { - case ArchiveStreamFactory.SEVEN_Z: - list7z(file); - break; - case ArchiveStreamFactory.ZIP: - listZipUsingZipFile(file); - break; - case ArchiveStreamFactory.TAR: - listZipUsingTarFile(file); - break; - default: - listStream(file, args); - } + list(file, args); } private static void println(final ArchiveEntry entry) {