com.compomics.util.io
Class TarUtils

java.lang.Object
  extended by com.compomics.util.io.TarUtils

public class TarUtils
extends Object

This class contains convenience methods for taring files.

Author:
Marc Vaudel

Constructor Summary
TarUtils()
           
 
Method Summary
static void addFolderContent(org.apache.commons.compress.archivers.ArchiveOutputStream tarOutput, File folder, WaitingHandler waitingHandler)
          Add content to the tar file.
static void extractFile(File tarFile, WaitingHandler waitingHandler)
          Extracts files from a tar.
static void tarFolder(File folder, File destinationFile, WaitingHandler waitingHandler)
          Tar a given folder in a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TarUtils

public TarUtils()
Method Detail

tarFolder

public static void tarFolder(File folder,
                             File destinationFile,
                             WaitingHandler waitingHandler)
                      throws FileNotFoundException,
                             org.apache.commons.compress.archivers.ArchiveException,
                             IOException
Tar a given folder in a file.

Parameters:
folder - the original folder to tar
destinationFile - the destination file
waitingHandler - a waiting handler used to cancel the process (can be null)
Throws:
FileNotFoundException - exception thrown whenever a file is not found
org.apache.commons.compress.archivers.ArchiveException - exception thrown whenever an error occurred while taring
IOException - exception thrown whenever an error occurred while reading/writing files

addFolderContent

public static void addFolderContent(org.apache.commons.compress.archivers.ArchiveOutputStream tarOutput,
                                    File folder,
                                    WaitingHandler waitingHandler)
                             throws FileNotFoundException,
                                    IOException
Add content to the tar file.

Parameters:
tarOutput - the archive output stream
folder - the folder to add
waitingHandler - a waiting handler used to cancel the process (can be null)
Throws:
FileNotFoundException - exception thrown whenever a file is not found
IOException - exception thrown whenever an error occurred while reading/writing files

extractFile

public static void extractFile(File tarFile,
                               WaitingHandler waitingHandler)
                        throws FileNotFoundException,
                               org.apache.commons.compress.archivers.ArchiveException,
                               IOException
Extracts files from a tar.

Parameters:
tarFile - the tar file
waitingHandler - a waiting handler displaying progress and allowing canceling the process
Throws:
FileNotFoundException
org.apache.commons.compress.archivers.ArchiveException
IOException


Copyright © 2013. All Rights Reserved.