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
Show file Open project: icsharpcode/SharpZipLib Class Usage Examples

Public Methods

Method 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

Method Description
TarEntry ( ) : System

Initialise a default instance of TarEntry.

Method Details

AdjustEntryName() public static method

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. ///
return void

Clone() public method

Clone this tar entry.
public Clone ( ) : object
return object

CreateEntryFromFile() public static method

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.
return TarEntry

CreateTarEntry() public static method

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
return TarEntry

Equals() public method

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.
return bool

GetDirectoryEntries() public method

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[]
return ICSharpCode.SharpZipLib.Tar.TarEntry[]

GetFileTarHeader() public method

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. ///
return void

GetHashCode() public method

Derive a Hash value for the current Object
public GetHashCode ( ) : int
return int

IsDescendent() public method

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. ///
return bool

NameTarHeader() public static method

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. ///
return void

SetIds() public method

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. ///
return void

SetNames() public method

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. ///
return void

TarEntry() public method

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

TarEntry() public method

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. ///
return System

WriteEntryHeader() public method

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. ///
return void