Zeta Components Manual :: Docs For Class ezcArchiveGnuTar
Archive::ezcArchiveGnuTar
Class ezcArchiveGnuTar
The ezcArchiveGnuTar class implements the GNU Tar archive format.
ezcArchiveGnuTar is a subclass from ezcArchive that provides the common interface, and ezcArchiveUstarTar that provides the basic Tar implementation.
ezcArchiveGnuTar reads on creation only the first entry from the archive. When needed next entries are read.
The Gnu Tar algorithm is an extension of Ustar Tar. Gnu has the following extended features compared to Ustar:
- Filenames of unlimited size.
- File size is unlimited.
The features of Gnu Tar and Pax Tar are quite similar, although their approach is different.
Source for this file: /Archive/src/tar/gnu.php
ezcArchive | --ezcArchiveV7Tar | --ezcArchiveUstarTar | --ezcArchiveGnuTar
Version: | //autogentag// |
Inherited Constants
From ezcArchiveV7Tar: | |
---|---|
ezcArchiveV7Tar::BLOCK_SIZE
|
Amount of bytes in a block. |
From ezcArchive: | |
ezcArchive::BZIP2
|
BZIP2 compression format. |
ezcArchive::GZIP
|
Gnu ZIP compression format. |
ezcArchive::TAR
|
Normal tar archive. |
ezcArchive::TAR_GNU
|
GNU tar archive. |
ezcArchive::TAR_PAX
|
PAX tar archive. |
ezcArchive::TAR_USTAR
|
USTAR tar archive. |
ezcArchive::TAR_V7
|
Tar version 7 archive. |
ezcArchive::ZIP
|
ZIP archive. |
Inherited Member Variables
From ezcArchiveV7Tar | |
---|---|
protected |
ezcArchiveV7Tar::$addedBlocks
|
protected |
ezcArchiveV7Tar::$addedBlocksNotReliable
|
protected |
ezcArchiveV7Tar::$blockFactor
|
protected |
ezcArchiveV7Tar::$hasNullBlocks
|
protected |
ezcArchiveV7Tar::$headerPositions
|
protected |
ezcArchiveV7Tar::$headers
|
From ezcArchive | |
protected |
ezcArchive::$completed
|
protected |
ezcArchive::$entries
|
protected |
ezcArchive::$entriesRead
|
protected |
ezcArchive::$file
|
protected |
ezcArchive::$fileNumber
|
protected |
ezcArchive::$options
|
Method Summary
public ezcArchiveGnuTar |
__construct(
$blockFile
, [ $blockFactor
= 20] )
Initializes the Tar and tries to read the first entry from the archive. |
public bool |
algorithmCanWrite(
)
Returns false because the TAR_PAX algorithm cannot write (yet). |
protected ezcArchiveGnuHeader |
createTarHeader(
[ $file
= null] )
Creates the a new pax tar header for this class. |
public int |
getAlgorithm(
)
Returns the value which specifies a TAR_GNU algorithm. |
Inherited Methods
From ezcArchiveUstarTar | |
---|---|
public ezcArchiveUstarTar |
ezcArchiveUstarTar::__construct()
Initializes the Tar and tries to read the first entry from the archive. |
public bool |
ezcArchiveUstarTar::algorithmCanWrite()
Returns true because the TAR_USTAR algorithm can write. |
protected ezcArchiveUstarHeader |
ezcArchiveUstarTar::createTarHeader()
Creates the a new ustar tar header for this class. |
public int |
ezcArchiveUstarTar::getAlgorithm()
Returns the value which specifies a TAR_USTAR algorithm. |
From ezcArchiveV7Tar | |
public ezcArchiveV7Tar |
ezcArchiveV7Tar::__construct()
Initializes the Tar and tries to read the first entry from the archive. |
public bool |
ezcArchiveV7Tar::algorithmCanWrite()
Returns true because the TAR_V7 algorithm can write. |
public bool |
ezcArchiveV7Tar::append()
Append a file or directory to the end of the archive. Multiple files or directory can be added to the archive when an array is used as input parameter. |
protected bool |
ezcArchiveV7Tar::appendHeaderAndFileToCurrent()
Appends the given ezcArchiveBlockFile $file and ezcArchiveEntry $entry to the archive file. |
protected void |
ezcArchiveV7Tar::appendNullBlocks()
Appends zero or more null blocks to the end of the archive, so that it matches the $blockFactor. |
public bool |
ezcArchiveV7Tar::appendToCurrent()
Appends a file to the archive after the current entry. |
public void |
ezcArchiveV7Tar::close()
Closes the archive correctly. |
protected ezcArchiveV7Header |
ezcArchiveV7Tar::createTarHeader()
Creates the a new tar header for this class. |
public int |
ezcArchiveV7Tar::getAlgorithm()
Returns the value which specifies a TAR_V7 algorithm. |
protected bool |
ezcArchiveV7Tar::readCurrentFromArchive()
Read the current entry from the archive. |
public bool |
ezcArchiveV7Tar::truncate()
Truncates the archive to $fileNumber of files. |
protected bool |
ezcArchiveV7Tar::writeCurrentDataToFile()
Writes the file data from the current entry to the given file. |
public void |
ezcArchiveV7Tar::writeEnd()
Writes the end of the archive. |
public void |
ezcArchiveV7Tar::__destruct()
Closes the archive. |
From ezcArchive | |
public abstract bool |
ezcArchive::algorithmCanWrite()
Returns true if writing to the archive is implemented, otherwise false. |
public abstract bool |
ezcArchive::append()
Appends a file or directory to the end of the archive. Multiple files or directory can be added to the archive when an array is used as input parameter. |
public abstract bool |
ezcArchive::appendToCurrent()
Appends a file to the archive after the current entry. |
public void |
ezcArchive::close()
Close the current archive. |
protected void |
ezcArchive::createDefaultDirectory()
Creates all the directories needed to create the file $file. |
protected static ezcArchive |
ezcArchive::createInstance()
Returns an instance of the archive with the given type. |
public ezcArchiveEntry |
ezcArchive::current()
Returns the current ezcArchiveEntry if it is valid, otherwise false is returned. |
public void |
ezcArchive::extract()
Extract entries from the archive to the target directory. |
public bool |
ezcArchive::extractCurrent()
Extract the current entry to which the iterator points. |
public abstract int |
ezcArchive::getAlgorithm()
Returns the algorithm that is used currently. |
protected ezcArchiveEntry |
ezcArchive::getEntries()
Get the file entries from the archive. |
public array(string) |
ezcArchive::getListing()
Returns an array that lists the content of the archive. |
public static ezcArchive |
ezcArchive::getTarInstance()
Open a tar instance. |
public static ezcArchive |
ezcArchive::getZipInstance()
Open a zip instance. This method is made public for testing purposes, and should not be used. |
public bool |
ezcArchive::isEmpty()
Returns true if the current archive is empty, otherwise false. |
public int |
ezcArchive::key()
Returns the current key, entry number, if it is valid, otherwise false is returned. |
public ezcArchiveEntry |
ezcArchive::next()
Forwards the iterator to the next entry. |
public static ezcArchive |
ezcArchive::open()
Returns a new ezcArchive instance. |
public void |
ezcArchive::rewind()
Rewinds the iterator to the first entry. |
public bool |
ezcArchive::seek()
Search for the entry number. |
public void |
ezcArchive::setOptions()
This method associates a new $options object with this archive. |
public abstract bool |
ezcArchive::truncate()
Truncates the archive to $fileNumber of files. |
public bool |
ezcArchive::valid()
Returns true if the iterator points to a valid entry, otherwise false. |
protected abstract void |
ezcArchive::writeCurrentDataToFile()
Writes the file data from the current entry to the given file. |
public string |
ezcArchive::__toString()
Returns a string which represents all the entries from the archive. |
Methods
__construct
Initializes the Tar and tries to read the first entry from the archive.
At initialization it sets the blockFactor to $blockFactor. Each tar archive has always $blockFactor of blocks ( 0, $blockFactor, 2 * $blockFactor, etc ).
The Tar archive works with blocks, so therefore the first parameter expects the archive as a blockFile.
Parameters:
Name | Type | Description |
---|---|---|
$blockFile |
ezcArchiveBlockFile | |
$blockFactor |
int |
Redefinition of:
Method | Description |
---|---|
ezcArchiveUstarTar::__construct() |
Initializes the Tar and tries to read the first entry from the archive. |
algorithmCanWrite
Returns false because the TAR_PAX algorithm cannot write (yet).
Redefinition of:
Method | Description |
---|---|
ezcArchiveUstarTar::algorithmCanWrite() |
Returns true because the TAR_USTAR algorithm can write. |
createTarHeader
Creates the a new pax tar header for this class.
This method expects an ezcArchiveBlockFile that points to the header that should be read (and created). If null is given as block file, an empty header will be created.
Parameters:
Name | Type | Description |
---|---|---|
$file |
string|null |
Redefinition of:
Method | Description |
---|---|
ezcArchiveUstarTar::createTarHeader() |
Creates the a new ustar tar header for this class. |
getAlgorithm
Returns the value which specifies a TAR_GNU algorithm.
Redefinition of:
Method | Description |
---|---|
ezcArchiveUstarTar::getAlgorithm() |
Returns the value which specifies a TAR_USTAR algorithm. |