org.crosswire.common.util

## Class IOUtil

- java.lang.Object
- - org.crosswire.common.util.IOUtil

-     public final class IOUtil
      extends Object

  .
  Author:
    Joe Walker
  See Also:
    `The GNU Lesser General Public License for details.`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static org.slf4j.Logger` | `log` The log stream

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `IOUtil()` Prevent instantiation

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `close(Closeable closeable)` Closes any `Closeable` object
    `static byte[]` | `getZipEntry(String entrySpec)` Get a zip entry by specification, returning a buffer of the contents.
    `static void` | `unpackZip(File file, File destdir)` Unpack a zip file to a given directory.
    `static void` | `unpackZip(File file, File destdir, boolean include, String... includeExcludes)` Unpack a zip file to a given directory.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### log

          private static final org.slf4j.Logger log

      The log stream

  - ### Constructor Detail

    - #### IOUtil

          private IOUtil()

      Prevent instantiation

  - ### Method Detail

    - #### unpackZip

          public static void unpackZip(File file,
                       File destdir)
                                throws IOException

      Unpack a zip file to a given directory. Honor the paths as given in the zip file.
      Parameters:
        `file` - The zip file to download
        `destdir` - The directory to unpack up
      Throws:
        `IOException` - If there is an file error

    - #### unpackZip

          public static void unpackZip(File file,
                       File destdir,
                       boolean include,
                       String... includeExcludes)
                                throws IOException

      Unpack a zip file to a given directory. Honor the paths as given in the zip file.
      Parameters:
        `file` - The zip file to download
        `destdir` - The directory to unpack up
        `include` - true to indicate the next arguments will be a filter that only includes what is specified.
        `includeExcludes` - a list of case insensitive patterns that will act as an inclusion or exclusion prefix
      Throws:
        `IOException` - If there is an file error

    - #### getZipEntry

          public static byte[] getZipEntry(String entrySpec)
                                    throws IOException

      Get a zip entry by specification, returning a buffer of the contents. If there is an error, return a zero length buffer.
      Parameters:
        `entrySpec` - This is of the form /path/to/zip!entryName
      Returns:
        the contents as a buffer
      Throws:
        `IOException`

    - #### close

          public static void close(Closeable closeable)

      Closes any `Closeable` object
      Parameters:
        `closeable` - The zip file to close