Appearance
Tarball Class
Definition
Represents a simple in-memory tar archive, allowing files to be added, extracted from a tar byte stream, and serialized back into tar format.
- Namespace:
JASE - Assembly:
JASE.Compression.dll
Constructors
| Name | Description |
|---|---|
Tarball() | Create an empty instance of a Tarball |
Tarball(byte[] tarContent) | Create a Traball from the provided byte[] |
Properties
| Name | Description |
|---|---|
Files | File content of the Tarball. Returns a shallow copy of the internal map so callers |
Methods
| Name | Description |
|---|---|
bool AddFile(string name, byte[] content) | Adds or replaces a file entry in the current tarball. |
Dictionary<string, byte[]> ExtractTar(byte[] tarBytes) | Extracts the contents of a tar archive from the specified byte array and populates the Files collection. |
byte[] GetTar() | Builds a tar archive from the current Files collection. |
Remarks
This implementation targets the classic ustar-style tar layout using 512-byte blocks and a minimal header:
File names are stored in the first 100 bytes of the header.File size is encoded as an octal value at offset 124.The ustar magic field is written at offset 257. Files are padded to the next 512-byte boundary. Two 512-byte zero blocks terminate the archive.
Directories, extended headers, and POSIX/PAX extensions are not currently supported. This class is intended for basic in-memory tar scenarios and small archives, not as a fully general tar implementation.