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.

Static Private Member Functions

static void ExtractFile (String sTarball, TarEntry oEntry, File oDestFile) throws java.io. IOException
 Extracts a single file from a tar archive.


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)


Member Function Documentation

static void javawrapper::Tarball::CleanUp String  sTarball,
String  sTempDir,
String  sTempRoot
[inline, 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

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

static void javawrapper::Tarball::ExtractFile String  sTarball,
TarEntry  oEntry,
File  oDestFile
throws java.io. IOException [inline, static, private]
 

Extracts a single file from a tar archive.

I grabbed and modified this from the TarTool package - method ice.com.tartool.ArchiveTreePanel.extractFile. That code is in the public domain. The original author is Timothy Gerard Endres.

I stripped out the code that didn't have anything to do with how our files work. The original code supported MIME types and ascii files, and we will never be bothering with either.

When I say that this method "extracts" a file, what it does is copies the contents of the file out of the tar archive and into a destination file. The original tar archive is unchanged and still contains the extracted file.

Parameters:
sTarball The filename of the tar file.
oEntry The TarEntry corresponding to the file to extract.
oDestFile The file to which to write the extracted file's contents.
Exceptions:
java.io.IOException if there is a problem writing the file.

static String javawrapper::Tarball::ExtractTarball String  sTarball,
String  sTempRoot
throws ModelException [inline, 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.

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

static String javawrapper::Tarball::ExtractTarballFile String  sTarball,
String  sFileName
throws ModelException [inline, 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 String [] javawrapper::Tarball::GetTarballEntries String  sTarball  )  throws ModelException [inline, 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.

static InputStream javawrapper::Tarball::UnzipFile String  sFileToGet  )  throws ModelException [inline, 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)


The documentation for this class was generated from the following file:
Generated on Mon Mar 27 15:15:48 2006 for SORTIE Java Interface by  doxygen 1.4.6-NO