Zeta Components Manual :: Docs For Class ezcArchiveUstarTar
Archive::ezcArchiveUstarTar
Class ezcArchiveUstarTar
The ezcArchiveUstarTar class implements the Tar ustar archive format.
ezcArchiveUstarTar is a subclass from ezcArchive that provides the common interface, and ezcArchiveV7Tar that provides the basic Tar implementation.
ezcArchiveUstarTar reads on creation only the first entry from the archive. When needed next entries are read.
The Ustar Tar algorithm is an extension of V7 Tar. Ustar has the following extended features:
- Filenames up to 255 characters.
- Stores the owner and group by ID and Name.
- Can archive: regular files, symbolic links, hard links, fifo's, and devices.
Source for this file: /Archive/src/tar/ustar.php
Implements interfaces:
- Iterator (internal interface)
ezcArchive | --ezcArchiveV7Tar | --ezcArchiveUstarTar
Version: | //autogentag// |
Descendants
Child Class | Description |
---|---|
ezcArchiveGnuTar | The ezcArchiveGnuTar class implements the GNU Tar archive format. |
ezcArchivePaxTar | The ezcArchivePaxTar class implements the Tar pax or posix archive format. |
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 ezcArchiveUstarTar |
__construct(
$blockFile
, [ $blockFactor
= 20] )
Initializes the Tar and tries to read the first entry from the archive. |
public bool |
algorithmCanWrite(
)
Returns true because the TAR_USTAR algorithm can write. |
protected ezcArchiveUstarHeader |
createTarHeader(
[ $file
= null] )
Creates the a new ustar tar header for this class. |
public int |
getAlgorithm(
)
Returns the value which specifies a TAR_USTAR algorithm. |
Inherited Methods
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 |
---|---|
ezcArchiveV7Tar::__construct() |
Initializes the Tar and tries to read the first entry from the archive. |
Redefined in descendants as:
Method | Description |
---|---|
ezcArchiveGnuTar::__construct() |
Initializes the Tar and tries to read the first entry from the archive. |
ezcArchivePaxTar::__construct() |
Initializes the Tar and tries to read the first entry from the archive. |
algorithmCanWrite
Returns true because the TAR_USTAR algorithm can write.
Redefinition of:
Method | Description |
---|---|
ezcArchiveV7Tar::algorithmCanWrite() |
Returns true because the TAR_V7 algorithm can write. |
Redefined in descendants as:
Method | Description |
---|---|
ezcArchiveGnuTar::algorithmCanWrite() |
Returns false because the TAR_PAX algorithm cannot write (yet). |
ezcArchivePaxTar::algorithmCanWrite() |
Returns false because the TAR_PAX algorithm cannot write (yet). |
createTarHeader
Creates the a new ustar 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 |
---|---|
ezcArchiveV7Tar::createTarHeader() |
Creates the a new tar header for this class. |
Redefined in descendants as:
Method | Description |
---|---|
ezcArchiveGnuTar::createTarHeader() |
Creates the a new pax tar header for this class. |
ezcArchivePaxTar::createTarHeader() |
Creates the a new pax tar header for this class. |
getAlgorithm
Returns the value which specifies a TAR_USTAR algorithm.
Redefinition of:
Method | Description |
---|---|
ezcArchiveV7Tar::getAlgorithm() |
Returns the value which specifies a TAR_V7 algorithm. |
Redefined in descendants as:
Method | Description |
---|---|
ezcArchiveGnuTar::getAlgorithm() |
Returns the value which specifies a TAR_GNU algorithm. |
ezcArchivePaxTar::getAlgorithm() |
Returns the value which specifies a TAR_PAX algorithm. |