C# Класс ICSharpCode.SharpZipLib.Tar.TarEntry

This class represents an entry in a Tar archive. It consists of the entry's header, as well as the entry's File. Entries can be instantiated in one of three ways, depending on how they are to be used.

TarEntries that are created from the header bytes read from an archive are instantiated with the TarEntry( byte[] ) constructor. These entries will be used when extracting from or listing the contents of an archive. These entries have their header filled in using the header bytes. They also set the File to null, since they reference an archive entry not a file.

TarEntries that are created from files that are to be written into an archive are instantiated with the CreateEntryFromFile(string) pseudo constructor. These entries have their header filled in using the File's information. They also keep a reference to the File for convenience when writing entries.

Finally, TarEntries can be constructed from nothing but a name. This allows the programmer to construct the entry by hand, for instance when only an InputStream is available for writing to the archive, and the header information is constructed from other information. In this case the header fields are set to defaults and the File is set to null.

TarHeader
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AdjustEntryName ( byte buffer, string newName ) : void

Convenience method that will modify an entry's name directly in place in an entry header buffer byte array.

Clone ( ) : object

Clone this tar entry.

CreateEntryFromFile ( string fileName ) : TarEntry

Construct an entry for a file. File is set to file, and the header is constructed from information from the file.

CreateTarEntry ( string name ) : TarEntry

Construct an entry with only a name. This allows the programmer to construct the entry's header "by hand".

Equals ( object obj ) : bool

Determine if the two entries are equal. Equality is determined by the header names being equal.

GetDirectoryEntries ( ) : ICSharpCode.SharpZipLib.Tar.TarEntry[]

Get entries for all files present in this entries directory. If this entry doesnt represent a directory zero entries are returned.

GetFileTarHeader ( TarHeader header, string file ) : void

Fill in a TarHeader with information from a File.

GetHashCode ( ) : int

Derive a Hash value for the current Object

IsDescendent ( TarEntry toTest ) : bool

Determine if the given entry is a descendant of this entry. Descendancy is determined by the name of the descendant starting with this entry's name.

NameTarHeader ( TarHeader header, string name ) : void

Fill in a TarHeader given only the entry's name.

SetIds ( int userId, int groupId ) : void

Convenience method to set this entry's group and user ids.

SetNames ( string userName, string groupName ) : void

Convenience method to set this entry's group and user names.

TarEntry ( TarHeader header ) : System

Construct a TarEntry using the header provided

TarEntry ( byte headerBuffer ) : System

Construct an entry from an archive's header bytes. File is set to null.

WriteEntryHeader ( byte outBuffer ) : void

Write an entry's header information to a header buffer.

Приватные методы

Метод Описание
TarEntry ( ) : System

Initialise a default instance of TarEntry.

Описание методов

AdjustEntryName() публичный статический Метод

Convenience method that will modify an entry's name directly in place in an entry header buffer byte array.
public static AdjustEntryName ( byte buffer, string newName ) : void
buffer byte /// The buffer containing the entry header to modify. ///
newName string /// The new name to place into the header buffer. ///
Результат void

Clone() публичный Метод

Clone this tar entry.
public Clone ( ) : object
Результат object

CreateEntryFromFile() публичный статический Метод

Construct an entry for a file. File is set to file, and the header is constructed from information from the file.
public static CreateEntryFromFile ( string fileName ) : TarEntry
fileName string The file name that the entry represents.
Результат TarEntry

CreateTarEntry() публичный статический Метод

Construct an entry with only a name. This allows the programmer to construct the entry's header "by hand".
public static CreateTarEntry ( string name ) : TarEntry
name string The name to use for the entry
Результат TarEntry

Equals() публичный Метод

Determine if the two entries are equal. Equality is determined by the header names being equal.
public Equals ( object obj ) : bool
obj object The to compare with the current Object.
Результат bool

GetDirectoryEntries() публичный Метод

Get entries for all files present in this entries directory. If this entry doesnt represent a directory zero entries are returned.
public GetDirectoryEntries ( ) : ICSharpCode.SharpZipLib.Tar.TarEntry[]
Результат ICSharpCode.SharpZipLib.Tar.TarEntry[]

GetFileTarHeader() публичный Метод

Fill in a TarHeader with information from a File.
public GetFileTarHeader ( TarHeader header, string file ) : void
header TarHeader /// The TarHeader to fill in. ///
file string /// The file from which to get the header information. ///
Результат void

GetHashCode() публичный Метод

Derive a Hash value for the current Object
public GetHashCode ( ) : int
Результат int

IsDescendent() публичный Метод

Determine if the given entry is a descendant of this entry. Descendancy is determined by the name of the descendant starting with this entry's name.
public IsDescendent ( TarEntry toTest ) : bool
toTest TarEntry /// Entry to be checked as a descendent of this. ///
Результат bool

NameTarHeader() публичный статический Метод

Fill in a TarHeader given only the entry's name.
public static NameTarHeader ( TarHeader header, string name ) : void
header TarHeader /// The TarHeader to fill in. ///
name string /// The tar entry name. ///
Результат void

SetIds() публичный Метод

Convenience method to set this entry's group and user ids.
public SetIds ( int userId, int groupId ) : void
userId int /// This entry's new user id. ///
groupId int /// This entry's new group id. ///
Результат void

SetNames() публичный Метод

Convenience method to set this entry's group and user names.
public SetNames ( string userName, string groupName ) : void
userName string /// This entry's new user name. ///
groupName string /// This entry's new group name. ///
Результат void

TarEntry() публичный Метод

Construct a TarEntry using the header provided
public TarEntry ( TarHeader header ) : System
header TarHeader Header details for entry
Результат System

TarEntry() публичный Метод

Construct an entry from an archive's header bytes. File is set to null.
public TarEntry ( byte headerBuffer ) : System
headerBuffer byte /// The header bytes from a tar archive entry. ///
Результат System

WriteEntryHeader() публичный Метод

Write an entry's header information to a header buffer.
public WriteEntryHeader ( byte outBuffer ) : void
outBuffer byte /// The tar entry header buffer to fill in. ///
Результат void