This concept allow to read and write the traditional UNIX tar file.
It currently supports creating, listing, removing and extracting from archives.
It also supports GZIP - ed archives.
Create specified not compressed tar archive
and extract all files from achive in specified directory
$tar = Tar.create("tarName", false)
$tar.extractAll("dirName")
Add files and string to tar archive.
$tFile = Tar.create("TarName")
$tFile.add("filePath")
$tFile.add("text", "asPath")
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
Parameters: |
$path : |
The path to the location where the file will be created with the archive
name.
|
$compress : | Determines if the tar file will be compressed or not. |
|
Creates a new tar archive file with the specified path.
Parameters: |
$path : | The path to the file which will be added. |
|
Exceptions: |
IOException :
(Error) | If unable to open tar archive. |
IOException :
(Warning) | If could not add file to tar archive. |
pathNotFoundException :
(Error) | If the specified directory or file not exists. |
Adds the specified file to this archive.
$tarFile = Tar.create( "test.tgz", true )
$tarFile.add( "/devel/spacemapper/mn8/src/main/org/media/naming/" )
print $tarFile.list
-- the result is --
devel/spacemapper/mn8/src/main/org/media/naming/CVS/Root
devel/spacemapper/mn8/src/main/org/media/naming/CVS/Repository
devel/spacemapper/mn8/src/main/org/media/naming/CVS/Entries
devel/spacemapper/mn8/src/main/org/media/naming/ReferenceRefAddr.java
devel/spacemapper/mn8/src/main/org/media/naming/MemoryContextTest.java
devel/spacemapper/mn8/src/main/org/media/naming/MemoryContextFactory.java
devel/spacemapper/mn8/src/main/org/media/naming/MemoryContext.java
devel/spacemapper/mn8/src/main/org/media/naming/MemoryBinding.java
devel/spacemapper/mn8/src/main/org/media/naming/package.html
Parameters: |
$content : | The content of the file specified in the $path. |
$path : | The path to the file in the archive. |
|
Exceptions: |
IOException :
(Error) | If unable to open tar archive. |
IOException :
(Warning) | If could not add file to tar archive. |
Adds a new file to this archive with the name specified in the $path and
with the given $content.
$tarFile = Tar.create( "test.tar", false )
$tarFile.add("This is a test", "text.txt")
$tarFile.add("This is another test", "text1.txt")
print $tarFile.list
-- the result is --
text.txt
text1.txt
Parameters: |
$path : | The path to the file in this archive which will be deleted. |
|
Exceptions: |
IOException :
(Error) | If unable to remove entry form tar archive. |
pathNotFoundException :
(Error) | If unable to open tar archive. |
Deletes the specified file from this archive.
$tarFile = Tar.create( "test.tgz", true )
$tarFile.add("This is a test", "text.txt")
$tarFile.add("This is another test", "text1.txt")
$tarFile.delete("text1.txt")
print $tarFile.list
-- the result is --
text.txt
Parameters: |
$dir : |
The path to the directory in which will be extracted the specified file. |
$path : |
The path to the file in this archive which will be extracted. |
|
Exceptions: |
fileExistsException :
(Warning) | If the file is already exists. |
IOException :
(Error) | If unable to read tar archive. |
pathNotFoundException :
(Error) | If unable to read tar archive. |
Extracts the specified file from this archive in the given directory.
$tarFile = Tar.create( "test.tgz" )
$tarFile.add("This is a test", "text.txt")
$tarFile.add("This is another test", "text1.txt")
print $tarFile.extract("/temp/", "text.txt")
-- the result is --
Extract 'text.txt' file from archive.
Parameters: |
$dir : |
The path to the directory in which will be extracted this archive. |
|
Exceptions: |
fileExistsException :
(Warning) | If the file is already exists. |
IOException :
(Error) | If unable to read tar archive. |
pathNotFoundException :
(Error) | If unable to read tar archive. |
Extracts all files from this archive in the specified directory.
$tarFile = Tar.create( "test.tar", false )
$tarFile.add("This is a test", "text.txt")
$tarFile.add("This is another test", "text1.txt")
print $tarFile.extractAll("/temp/")
-- the result is --
Extract all files from archive.
Exceptions: |
IOException :
(Error) | If unable to open tar archive. |
Returns a series which contains all files name in this archive.
$tarFile = Tar.create( "test.tar", false )
$tarFile.add("This is a test", "text.txt")
$tarFile.add("This is another test", "text1.txt")
print $tarFile.list
-- the result is --
text.txt
text1.txt
Parameters: |
$path : | The path in this archive to the file. |
|
Exceptions: |
pathNotFoundException :
(Warning) | If the entry not exists in tar archive. |
IOException :
(Error) | If unable to read tar archive. |
Returns the file content specified by the $path.
$tarFile = Tar.create( "test.tar", false )
$tarFile.add("This is a test", "text.txt")
$tarFile.add("This is another test", "text1.txt")
print $tarFile.wiew("text.txt")
-- the result is --
This is a test