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. |
Copyright: Copyright (c) Charles D. Canham 2003
Company: Institute of Ecosystem Studies
static void javawrapper::Tarball::CleanUp | ( | String | sTarball, | |
String | sTempDir, | |||
String | sTempRoot | |||
) | [inline, static] |
Deletes all files from the tarball in the temp folder.
sTarball | Tarball with the files to delete. | |
sTempDir | Directory from which files should be cleaned | |
sTempRoot | Temp directory root |
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.
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. |
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.
sTarball | Tarball to extract | |
sTempRoot | Temp root directory |
ModelException | wraps IOExceptions. |
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.
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). |
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.
sTarball | Tarball for which to get entries. |
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.
sFileToGet | - the file to uncompress. |
ModelException | if the file is not found, or wrapping another exception. |