Class ZipUtils

java.lang.Object
com.axemble.vdoc.sdk.utils.ZipUtils

public class ZipUtils extends Object
A collection of methods to deal with ZIP API.
Since:
1.0, 08/01/2009
Author:
vlygeros
  • Constructor Details

    • ZipUtils

      public ZipUtils()
  • Method Details

    • zipDirectory

      public static boolean zipDirectory(File directory, OutputStream outputStream) throws IOException
      Allows to compress all the files within a specified directory.
      Parameters:
      directory - The directory to compress.
      outputStream - The OutputStream object.
      Returns:
      true if succeed, false otherwise.
      Throws:
      IOException - Any IOException.
    • zipFile

      public static boolean zipFile(File file, OutputStream outputStream) throws IOException
      Allows to compress a single file.
      Parameters:
      file - The file to compress.
      outputStream - The OutputStream object.
      Returns:
      true if succeed, false otherwise.
      Throws:
      IOException - Any IOException.
    • zipFiles

      public static boolean zipFiles(Collection files, OutputStream outputStream) throws IOException
      Allows to compress files and directories.
      Parameters:
      files - The list of the files to compress.
      outputStream - The OutputStream object.
      Returns:
      true if succeed, false otherwise.
      Throws:
      IOException - Any IOException.
    • unzipFile

      public static boolean unzipFile(InputStream inputStream, ZipUtils.ZipListener listener) throws IOException
      Allows to uncompress a InputStream using a listener.
      Parameters:
      inputStream - The InputStream to uncompress.
      listener - The ZipUtils.ZipListener object.
      Returns:
      true if succeed, false otherwise.
      Throws:
      IOException - Any IOException.
    • unzipFile

      public static boolean unzipFile(File file, ZipUtils.ZipListener listener) throws IOException
      Allows to uncompress a file using a listener.
      Parameters:
      file - The file to unzip.
      listener - The ZipUtils.ZipListener object.
      Returns:
      true if succeed, false otherwise.
      Throws:
      IOException - Any IOException.