javawrapper.Tarball Class Reference

Functions for working with tarballs (.gz.tar files). More...

List of all members.

Static Public Member Functions

static String ExtractTarball (String sTarball, String sTempRoot) throws ModelException
 Extracts a tarball's entries into the designated temp folder.
static InputStream UnzipFile (String sFileToGet) throws ModelException
 This converts a gzipped file to an uncompressed file stream.
static String ExtractTarballFile (String sTarball, String sFileName) throws ModelException
 Extracts a file from .gz.tar land to plaintext.
static void CleanUp (String sTarball, String sTempDir, String sTempRoot)
 Deletes all files from the tarball in the temp folder.
static String[] GetTarballEntries (String sTarball) throws ModelException
 Gets a list of file entries in the tarball.


Detailed Description

Functions for working with tarballs (.gz.tar files).

Copyright: Copyright (c) Charles D. Canham 2003

Company: Institute of Ecosystem Studies

Author:
Lora E. Murphy
Version:
1.0

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)
October 1, 2007: Improvements to use cross-system files
October 26, 2007: Updated to be able to work around the @longlink naming problem - the inability of older versions of TAR (such as ours) to handle long filenames (LEM)
February 4, 2008: Updated to conform to Java 6 compliance (LEM)

Member Function Documentation

static String javawrapper.Tarball.ExtractTarball ( String  sTarball,
String  sTempRoot 
) throws ModelException [static]

Extracts a tarball's entries into the designated temp folder.

If there is file info in the tar archive, they automatically get put in a sub folder of the root directory.

Parameters:
sTarball Tarball to extract
sTempRoot Temp root directory
Returns:
File where the files were extracted to.
Exceptions:
ModelException wraps IOExceptions.

static InputStream javawrapper.Tarball.UnzipFile ( String  sFileToGet  )  throws ModelException [static]

This converts a gzipped file to an uncompressed file stream.

Parameters:
sFileToGet - the file to uncompress.
Returns:
- InputStream - the uncompressed file stream
Exceptions:
ModelException if the file is not found, or wrapping another exception.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

static String javawrapper.Tarball.ExtractTarballFile ( String  sTarball,
String  sFileName 
) throws ModelException [static]

Extracts a file from .gz.tar land to plaintext.

The file will be placed in the same directory as the tarball.

Parameters:
sTarball Tarball in which the file is.
sFileName Name of file to extract, with no path information and with no .gz or .tar extension (but with its plaintext extension).
Returns:
The full filename and path of the extracted file, or null if the file was not found in the tarball.
Exceptions:
ModelException if the file is bad.

static void javawrapper.Tarball.CleanUp ( String  sTarball,
String  sTempDir,
String  sTempRoot 
) [static]

Deletes all files from the tarball in the temp folder.

Parameters:
sTarball Tarball with the files to delete.
sTempDir Directory from which files should be cleaned
sTempRoot Temp directory root

static String [] javawrapper.Tarball.GetTarballEntries ( String  sTarball  )  throws ModelException [static]

Gets a list of file entries in the tarball.

The list is of the core XML files, with no paths attached.

Parameters:
sTarball Tarball for which to get entries.
Returns:
An array of filenames in the tarball, no path info, no .gz extension, or null if the tarball is empty.
Exceptions:
ModelException if there is a problem reading the file.


The documentation for this class was generated from the following file:

Generated on Wed Oct 28 14:01:24 2009 for SORTIE Java Interface by  doxygen 1.5.6