com.vaadin.flow.server.frontend.

Class CompressUtil

java.lang.Object
com.vaadin.flow.server.frontend.CompressUtil
public class CompressUtil extends Object

Utility class for compression and decompression of folders and files.

Since:

24.3

Author:

Vaadin Ltd

  • Method Details

    • compressDirectory

      public static void compressDirectory(File targetDirectory, File outfile)

      Compress target directory and children into given target outfile. All files will be zipped and the targetDirectory will not be in the package.

      Parameters:

      targetDirectory - directory content to compress

      outfile - file to compress directory content to

    • uncompressFile

      public static void uncompressFile(File zip, File targetDirectory)

      Uncompress given zip file content to the target directory.

      Parameters:

      zip - file to uncompress

      targetDirectory - target directory to uncompress files to

    • readFileContentFromZip

      public static String readFileContentFromZip(File zip, String filename) throws IOException

      Read a file content from the given zip file.

      Parameters:

      zip - Target zip file

      filename - Target file name

      Returns:

      File content or null if not found

      Throws:

      IOException - if an I/O error occurs