Class CompressionUtils

java.lang.Object
com.kheops.util.CompressionUtils

public class CompressionUtils extends Object
  • Constructor Details

    • CompressionUtils

      public CompressionUtils()
  • Method Details

    • unzipFile

      public static boolean unzipFile(File source, File dest) throws IOException
      Unzips the content of the specified compressed file to the specified destination directory.
      Parameters:
      source - the compressed file
      dest - the destination directory.
      Returns:
      true if the operation completes successfully
      Throws:
      IOException - if an error occurs
    • zipDirectory

      public static boolean zipDirectory(File source, File dest, boolean recursive) throws IOException
      Zips the content of the specified directory to the specified destination file.
      Parameters:
      source - the source directory
      dest - the destination compressed file. If the file already exists, it will be overwritten.
      recursive - zip the content of the source directory recursively
      Returns:
      true if the operation completes successfully
      Throws:
      IOException - if an error occurs
    • zipDirectory

      public static boolean zipDirectory(File source, OutputStream stream, boolean recursive) throws IOException
      Throws:
      IOException
    • compress

      public static byte[] compress(byte[] data) throws IOException
      Throws:
      IOException
    • decompress

      public static byte[] decompress(byte[] data) throws IOException, DataFormatException
      Throws:
      IOException
      DataFormatException