Top Description Fields Constructors Methods
org.apache.commons.compress.archivers.tar

public Class TarArchiveSparseEntry

extends Object
implements TarConstants
Class Inheritance
All Implemented Interfaces
org.apache.commons.compress.archivers.tar.TarConstants
Imports
java.io.IOException, java.util.ArrayList, .List

This class represents a sparse entry in a Tar archive.

The C structure for a sparse entry is:

struct posix_header {
struct sparse sp[21]; // TarConstants.SPARSELEN_GNU_SPARSE     - offset 0
char isextended;      // TarConstants.ISEXTENDEDLEN_GNU_SPARSE - offset 504
};
Whereas, "struct sparse" is:
struct sparse {
char offset[12];   // offset 0
char numbytes[12]; // offset 12
};

Each such struct describes a block of data that has actually been written to the archive. The offset describes where in the extracted file the data is supposed to start and the numbytes provides the length of the block. When extracting the entry the gaps between the sparse structs are equivalent to areas filled with zero bytes.

Field Summary

Modifier and TypeField and Description
private final boolean
isExtended

If an extension sparse header follows.

private final List<TarArchiveStructSparse>

Constructor Summary

AccessConstructor and Description
public
TarArchiveSparseEntry(final byte[]
The header bytes from a tar archive entry.
headerBuf
)

Constructs an entry from an archive's header bytes.

Method Summary

Modifier and TypeMethod and Description
public List<TarArchiveStructSparse>

Returns:

information about the configuration for the sparse entry.
getSparseHeaders
()

Obtains information about the configuration for the sparse entry.

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

isExtendedback to summary
private final boolean isExtended

If an extension sparse header follows.

sparseHeadersback to summary
private final List<TarArchiveStructSparse> sparseHeaders

Constructor Detail

TarArchiveSparseEntryback to summary
public TarArchiveSparseEntry(final byte[] headerBuf) throws IOException

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

Parameters
headerBuf:byte[]

The header bytes from a tar archive entry.

Exceptions
IOException:
on unknown format

Method Detail

getSparseHeadersback to summary
public List<TarArchiveStructSparse> getSparseHeaders()

Obtains information about the configuration for the sparse entry.

Returns:List<TarArchiveStructSparse>

information about the configuration for the sparse entry.

Since
1.20
isExtendedback to summary
public boolean isExtended()