From bbd6e8a4f85c9d814bddc791dfd8d440dd57c78c Mon Sep 17 00:00:00 2001 From: pavl_g Date: Tue, 6 Aug 2024 16:34:26 -0400 Subject: [PATCH] snaploader-examples: applied API changes --- .../snaploader/examples/TestFilesystemMemoryLeak.java | 6 ++---- .../snaploader/examples/TestZipExtractor.java | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/snaploader-examples/src/main/java/electrostatic4j/snaploader/examples/TestFilesystemMemoryLeak.java b/snaploader-examples/src/main/java/electrostatic4j/snaploader/examples/TestFilesystemMemoryLeak.java index 71a4104..4e28724 100644 --- a/snaploader-examples/src/main/java/electrostatic4j/snaploader/examples/TestFilesystemMemoryLeak.java +++ b/snaploader-examples/src/main/java/electrostatic4j/snaploader/examples/TestFilesystemMemoryLeak.java @@ -35,13 +35,11 @@ import electrostatic4j.snaploader.filesystem.FileExtractionListener; import electrostatic4j.snaploader.filesystem.FileExtractor; import electrostatic4j.snaploader.filesystem.FileLocator; -import electrostatic4j.snaploader.filesystem.ZipCompressionType; import electrostatic4j.snaploader.platform.util.PropertiesProvider; import electrostatic4j.snaploader.util.SnapLoaderLogger; - -import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.zip.ZipFile; /** * Testing impacts of memory leaks, test this using jconsole. @@ -52,7 +50,7 @@ public class TestFilesystemMemoryLeak { public static void main(String[] args) throws Exception { /* Locates the image inside the Zip Compression */ SnapLoaderLogger.setLoggingEnabled(true); - final FileLocator fileLocator = new FileLocator(getZipAbsolutePath(), getFilePath(), ZipCompressionType.ZIP); + final FileLocator fileLocator = new FileLocator(new ZipFile(getZipAbsolutePath()), getFilePath()); /* Extracts the image filesystem from the Zip Compression */ final FileExtractor fileExtractor = new FileExtractor(fileLocator, getExtractionPath()); fileLocator.initialize(0); diff --git a/snaploader-examples/src/main/java/electrostatic4j/snaploader/examples/TestZipExtractor.java b/snaploader-examples/src/main/java/electrostatic4j/snaploader/examples/TestZipExtractor.java index fb5dfde..f03cf65 100644 --- a/snaploader-examples/src/main/java/electrostatic4j/snaploader/examples/TestZipExtractor.java +++ b/snaploader-examples/src/main/java/electrostatic4j/snaploader/examples/TestZipExtractor.java @@ -35,10 +35,11 @@ import electrostatic4j.snaploader.filesystem.FileExtractionListener; import electrostatic4j.snaploader.filesystem.FileExtractor; import electrostatic4j.snaploader.filesystem.FileLocator; -import electrostatic4j.snaploader.filesystem.ZipCompressionType; import electrostatic4j.snaploader.platform.util.PropertiesProvider; import electrostatic4j.snaploader.throwable.FilesystemResourceScavengingException; +import java.util.zip.ZipFile; + /** * Tests extracting an image compression from a Zip compression type filesystem using {@link FileExtractor} API. * @@ -48,7 +49,7 @@ public class TestZipExtractor { public static void main(String[] args) throws Exception { /* Locates the image inside the Zip Compression */ - final FileLocator fileLocator = new FileLocator(getZipAbsolutePath(), getFilePath(), ZipCompressionType.ZIP); + final FileLocator fileLocator = new FileLocator(new ZipFile(getZipAbsolutePath()), getFilePath()); /* Extracts the image filesystem from the Zip Compression */ final FileExtractor fileExtractor = new FileExtractor(fileLocator, getExtractionPath()); fileLocator.initialize(0);