Skip to content

Commit

Permalink
snaploader-examples: applied API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pavly-gerges committed Aug 6, 2024
1 parent e323af0 commit bbd6e8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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);
Expand Down

0 comments on commit bbd6e8a

Please sign in to comment.