|
Fingerprint_Card
|
The TarArchive class implements the concept of a 'Tape Archive'. A tar archive is a series of entries, each of which represents a file system object. Each entry in the archive consists of a header block followed by 0 or more data blocks. Directory entries consist only of the header block, and are followed by entries for the directory's contents. File entries consist of a header followed by the number of blocks needed to contain the file's contents. All entries are written on block boundaries. Blocks are 512 bytes long. More...


Public Member Functions | |
| void | SetKeepOldFiles (bool keepExistingFiles) |
| Set the flag that determines whether existing files are kept, or overwritten during extraction. | |
| void | SetAsciiTranslation (bool translateAsciiFiles) |
| Set the ascii file translation flag. | |
| void | SetUserInfo (int userId, string userName, int groupId, string groupName) |
| Set user and group information that will be used to fill in the tar archive's entry headers. This information is based on that available for the linux operating system, which is not always available on other operating systems. TarArchive allows the programmer to specify values to be used in their place. ApplyUserInfoOverrides is set to true by this call. | |
| void | CloseArchive () |
| Close the archive. | |
| void | ListContents () |
| Perform the "list" command for the archive contents. | |
| void | ExtractContents (string destinationDirectory) |
| Perform the "extract" command and extract the contents of the archive. | |
| void | WriteEntry (TarEntry sourceEntry, bool recurse) |
| Write an entry to the archive. This method will call the putNextEntry and then write the contents of the entry, and finally call closeEntry() for entries that are files. For directories, it will call putNextEntry(), and then, if the recurse flag is true, process each entry that is a child of the directory. | |
| void | Dispose () |
| Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. | |
| virtual void | Close () |
| Closes the archive and releases any associated resources. | |
Static Public Member Functions | |
| static TarArchive | CreateInputTarArchive (Stream inputStream) |
| The InputStream based constructors create a TarArchive for the purposes of extracting or listing a tar archive. Thus, use these constructors when you wish to extract files from or list the contents of an existing tar archive. | |
| static TarArchive | CreateInputTarArchive (Stream inputStream, int blockFactor) |
| Create TarArchive for reading setting block factor. | |
| static TarArchive | CreateOutputTarArchive (Stream outputStream) |
| Create a TarArchive for writing to, using the default blocking factor. | |
| static TarArchive | CreateOutputTarArchive (Stream outputStream, int blockFactor) |
| Create a tar archive for writing. | |
Protected Member Functions | |
| virtual void | OnProgressMessageEvent (TarEntry entry, string message) |
| Raises the ProgressMessage event. | |
| TarArchive () | |
| Constructor for a default TarArchive. | |
| TarArchive (TarInputStream stream) | |
| Initalise a TarArchive for input. | |
| TarArchive (TarOutputStream stream) | |
| Initialise a TarArchive for output. | |
| virtual void | Dispose (bool disposing) |
| Releases the unmanaged resources used by the FileStream and optionally releases the managed resources. | |
Properties | |
| bool | AsciiTranslate [get, set] |
| Get/set the ascii file translation flag. If ascii file translation is true, then the file is checked to see if it a binary file or not. If the flag is true and the test indicates it is ascii text file, it will be translated. The translation converts the local operating system's concept of line ends into the UNIX line end, ' ', which is the defacto standard for a TAR archive. This makes text files compatible with UNIX. | |
| string | PathPrefix [get, set] |
| PathPrefix is added to entry names as they are written if the value is not null. A slash character is appended after PathPrefix. | |
| string | RootPath [get, set] |
| RootPath is removed from entry names if it is found at the beginning of the name. | |
| bool | ApplyUserInfoOverrides [get, set] |
| Get or set a value indicating if overrides defined by SetUserInfo should be applied. | |
| int | UserId [get] |
| Get the archive user id. See ApplyUserInfoOverrides for detail on how to allow setting values on a per entry basis. | |
| string | UserName [get] |
| Get the archive user name. See ApplyUserInfoOverrides for detail on how to allow setting values on a per entry basis. | |
| int | GroupId [get] |
| Get the archive group id. See ApplyUserInfoOverrides for detail on how to allow setting values on a per entry basis. | |
| string | GroupName [get] |
| Get the archive group name. See ApplyUserInfoOverrides for detail on how to allow setting values on a per entry basis. | |
| int | RecordSize [get] |
| Get the archive's record size. Tar archives are composed of a series of RECORDS each containing a number of BLOCKS. This allowed tar archives to match the IO characteristics of the physical device being used. Archives are expected to be properly "blocked". | |
| bool | IsStreamOwner [set] |
| Sets the IsStreamOwner property on the underlying stream. Set this to false to prevent the Close of the TarArchive from closing the stream. | |
Events | |
| ProgressMessageHandler | ProgressMessageEvent |
| Client hook allowing detailed information to be reported during processing. | |
Private Member Functions | |
| void | ExtractEntry (string destDir, TarEntry entry) |
| Extract an entry from the archive. This method assumes that the tarIn stream has been properly set with a call to GetNextEntry(). | |
| void | WriteEntryCore (TarEntry sourceEntry, bool recurse) |
| Write an entry to the archive. This method will call the putNextEntry and then write the contents of the entry, and finally call closeEntry() for entries that are files. For directories, it will call putNextEntry(), and then, if the recurse flag is true, process each entry that is a child of the directory. | |
| ~TarArchive () | |
| Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the TarArchive. | |
Static Private Member Functions | |
| static void | EnsureDirectoryExists (string directoryName) |
| static bool | IsBinary (string filename) |
Private Attributes | |
| bool | keepOldFiles |
| bool | asciiTranslate |
| int | userId |
| string | userName = string.Empty |
| int | groupId |
| string | groupName = string.Empty |
| string | rootPath |
| string | pathPrefix |
| bool | applyUserInfoOverrides |
| TarInputStream | tarIn |
| TarOutputStream | tarOut |
| bool | isDisposed |
The TarArchive class implements the concept of a 'Tape Archive'. A tar archive is a series of entries, each of which represents a file system object. Each entry in the archive consists of a header block followed by 0 or more data blocks. Directory entries consist only of the header block, and are followed by entries for the directory's contents. File entries consist of a header followed by the number of blocks needed to contain the file's contents. All entries are written on block boundaries. Blocks are 512 bytes long.
TarArchives are instantiated in either read or write mode, based upon whether they are instantiated with an InputStream or an OutputStream. Once instantiated TarArchives read/write mode can not be changed.
There is currently no support for random access to tar archives. However, it seems that subclassing TarArchive, and using the TarBuffer.CurrentRecord and TarBuffer.CurrentBlock properties, this would be rather trivial.
|
protected |
|
protected |
Initalise a TarArchive for input.
| stream | The TarInputStream to use for input. |
|
protected |
Initialise a TarArchive for output.
| stream | The TarOutputStream to use for output. |
|
private |
Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the TarArchive.

|
virtual |
Closes the archive and releases any associated resources.


| void ICSharpCode.SharpZipLib.Tar.TarArchive.CloseArchive | ( | ) |
Close the archive.

|
static |
The InputStream based constructors create a TarArchive for the purposes of extracting or listing a tar archive. Thus, use these constructors when you wish to extract files from or list the contents of an existing tar archive.
| inputStream | The stream to retrieve archive data from. |


|
static |
Create TarArchive for reading setting block factor.
| inputStream | A stream containing the tar archive contents |
| blockFactor | The blocking factor to apply |

|
static |
Create a TarArchive for writing to, using the default blocking factor.
| outputStream | The Stream to write to |


|
static |
Create a tar archive for writing.
| outputStream | The stream to write to |
| blockFactor | The blocking factor to use for buffering. |

| void ICSharpCode.SharpZipLib.Tar.TarArchive.Dispose | ( | ) |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.


|
protectedvirtual |
Releases the unmanaged resources used by the FileStream and optionally releases the managed resources.
| disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
|
staticprivate |

| void ICSharpCode.SharpZipLib.Tar.TarArchive.ExtractContents | ( | string | destinationDirectory | ) |
Perform the "extract" command and extract the contents of the archive.
| destinationDirectory | The destination directory into which to extract. |

|
private |
Extract an entry from the archive. This method assumes that the tarIn stream has been properly set with a call to GetNextEntry().
| destDir | The destination directory into which to extract. |
| entry | The TarEntry returned by tarIn.GetNextEntry(). |


|
staticprivate |

| void ICSharpCode.SharpZipLib.Tar.TarArchive.ListContents | ( | ) |
Perform the "list" command for the archive contents.
NOTE That this method uses the progress event to actually list the contents. If the progress display event is not set, nothing will be listed!

|
protectedvirtual |
Raises the ProgressMessage event.
| entry | The TarEntry for this event |
| message | message for this event. Null is no message |


| void ICSharpCode.SharpZipLib.Tar.TarArchive.SetAsciiTranslation | ( | bool | translateAsciiFiles | ) |
Set the ascii file translation flag.
| translateAsciiFiles | If true, translate ascii text files. |
| void ICSharpCode.SharpZipLib.Tar.TarArchive.SetKeepOldFiles | ( | bool | keepExistingFiles | ) |
Set the flag that determines whether existing files are kept, or overwritten during extraction.
| keepExistingFiles | If true, do not overwrite existing files. |
| void ICSharpCode.SharpZipLib.Tar.TarArchive.SetUserInfo | ( | int | userId, |
| string | userName, | ||
| int | groupId, | ||
| string | groupName ) |
Set user and group information that will be used to fill in the tar archive's entry headers. This information is based on that available for the linux operating system, which is not always available on other operating systems. TarArchive allows the programmer to specify values to be used in their place. ApplyUserInfoOverrides is set to true by this call.
| userId | The user id to use in the headers. |
| userName | The user name to use in the headers. |
| groupId | The group id to use in the headers. |
| groupName | The group name to use in the headers. |
| void ICSharpCode.SharpZipLib.Tar.TarArchive.WriteEntry | ( | TarEntry | sourceEntry, |
| bool | recurse ) |
Write an entry to the archive. This method will call the putNextEntry and then write the contents of the entry, and finally call closeEntry() for entries that are files. For directories, it will call putNextEntry(), and then, if the recurse flag is true, process each entry that is a child of the directory.
| sourceEntry | The TarEntry representing the entry to write to the archive. |
| recurse | If true, process the children of directory entries. |


|
private |
Write an entry to the archive. This method will call the putNextEntry and then write the contents of the entry, and finally call closeEntry() for entries that are files. For directories, it will call putNextEntry(), and then, if the recurse flag is true, process each entry that is a child of the directory.
| sourceEntry | The TarEntry representing the entry to write to the archive. |
| recurse | If true, process the children of directory entries. |


|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
getset |
Get or set a value indicating if overrides defined by SetUserInfo should be applied.
If overrides are not applied then the values as set in each header will be used.
|
getset |
Get/set the ascii file translation flag. If ascii file translation is true, then the file is checked to see if it a binary file or not. If the flag is true and the test indicates it is ascii text file, it will be translated. The translation converts the local operating system's concept of line ends into the UNIX line end, '
', which is the defacto standard for a TAR archive. This makes text files compatible with UNIX.
|
get |
Get the archive group id. See ApplyUserInfoOverrides for detail on how to allow setting values on a per entry basis.
|
get |
Get the archive group name. See ApplyUserInfoOverrides for detail on how to allow setting values on a per entry basis.
|
set |
Sets the IsStreamOwner property on the underlying stream. Set this to false to prevent the Close of the TarArchive from closing the stream.
|
getset |
PathPrefix is added to entry names as they are written if the value is not null. A slash character is appended after PathPrefix.
|
get |
Get the archive's record size. Tar archives are composed of a series of RECORDS each containing a number of BLOCKS. This allowed tar archives to match the IO characteristics of the physical device being used. Archives are expected to be properly "blocked".
|
getset |
RootPath is removed from entry names if it is found at the beginning of the name.
|
get |
Get the archive user id. See ApplyUserInfoOverrides for detail on how to allow setting values on a per entry basis.
|
get |
Get the archive user name. See ApplyUserInfoOverrides for detail on how to allow setting values on a per entry basis.
| ProgressMessageHandler ICSharpCode.SharpZipLib.Tar.TarArchive.ProgressMessageEvent |
Client hook allowing detailed information to be reported during processing.