Package com.vaadin.flow.server.frontend
Class CompressUtil
java.lang.Object
com.vaadin.flow.server.frontend.CompressUtil
Utility class for compression and decompression of folders and files.
- Since:
- 24.3
- Author:
- Vaadin Ltd
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
compressDirectory
(File targetDirectory, File outfile) Compress target directory and children into given target outfile.static String
readFileContentFromZip
(File zip, String filename) Read a file content from the given zip file.static void
uncompressFile
(File zip, File targetDirectory) Uncompress given zip file content to the target directory.
-
Method Details
-
compressDirectory
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 compressoutfile
- file to compress directory content to
-
uncompressFile
Uncompress given zip file content to the target directory.- Parameters:
zip
- file to uncompresstargetDirectory
- target directory to uncompress files to
-
readFileContentFromZip
Read a file content from the given zip file.- Parameters:
zip
- Target zip filefilename
- Target file name- Returns:
- File content or
null
if not found - Throws:
IOException
- if an I/O error occurs
-