C# Class 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
Afficher le fichier Open project: icsharpcode/SharpZipLib Class Usage Examples

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
TarEntry ( ) : System

Initialise a default instance of TarEntry.

Method Details

AdjustEntryName() public static méthode

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. ///
Résultat void

Clone() public méthode

Clone this tar entry.
public Clone ( ) : object
Résultat object

CreateEntryFromFile() public static méthode

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.
Résultat TarEntry

CreateTarEntry() public static méthode

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
Résultat TarEntry

Equals() public méthode

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.
Résultat bool

GetDirectoryEntries() public méthode

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[]
Résultat ICSharpCode.SharpZipLib.Tar.TarEntry[]

GetFileTarHeader() public méthode

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. ///
Résultat void

GetHashCode() public méthode

Derive a Hash value for the current Object
public GetHashCode ( ) : int
Résultat int

IsDescendent() public méthode

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. ///
Résultat bool

NameTarHeader() public static méthode

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. ///
Résultat void

SetIds() public méthode

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. ///
Résultat void

SetNames() public méthode

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. ///
Résultat void

TarEntry() public méthode

Construct a TarEntry using the header provided
public TarEntry ( TarHeader header ) : System
header TarHeader Header details for entry
Résultat System

TarEntry() public méthode

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. ///
Résultat System

WriteEntryHeader() public méthode

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. ///
Résultat void