Class GzUtils

java.lang.Object
com.compomics.util.io.compression.GzUtils

public class GzUtils
extends Object
Convenience methods to work with gzipped files. Note: IOExceptions are thrown by each method as RuntimeException.
Author:
Marc Vaudel
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int BUFFER_LENGTH
    The length of the character buffer to use.
    static String GZ_EXTENSION
    The extension to use for gz files.
  • Constructor Summary

    Constructors 
    Constructor Description
    GzUtils()  
  • Method Summary

    Modifier and Type Method Description
    static void gunzipFile​(File gzFile, boolean remove)
    Uncompresses the given gz file to the given destination file.
    static void gunzipFile​(File gzFile, File destinationFile, boolean remove)
    Uncompresses the given gz file to the given destination file.
    static void gzFile​(File file, boolean remove)
    Gzip a file.If the gz file already exists it will be silently overwritten.
    static void gzFile​(File file, File gzFile, boolean remove)
    Gzip a file.If the gz file already exists it will be silently overwritten.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • gzFile

      public static void gzFile​(File file, boolean remove)
      Gzip a file.If the gz file already exists it will be silently overwritten.
      Parameters:
      file - the file to read
      remove - if true the original file will be removed
    • gzFile

      public static void gzFile​(File file, File gzFile, boolean remove)
      Gzip a file.If the gz file already exists it will be silently overwritten.
      Parameters:
      file - the file to read
      gzFile - the gz file to write
      remove - if true the original file will be removed
    • gunzipFile

      public static void gunzipFile​(File gzFile, boolean remove)
      Uncompresses the given gz file to the given destination file. If the destination file already exists it will be silently overwritten.
      Parameters:
      gzFile - the gz file to read
      remove - if true the gz file will be deleted upon completion
    • gunzipFile

      public static void gunzipFile​(File gzFile, File destinationFile, boolean remove)
      Uncompresses the given gz file to the given destination file. If the destination file already exists it will be silently overwritten.
      Parameters:
      gzFile - the gz file to read
      destinationFile - the file to write
      remove - if true the gz file will be deleted upon completion