Package org.apache.commons.compress.archivers.tar

# Class TarArchiveSparseEntry

java.lang.Object
org.apache.commons.compress.archivers.tar.TarArchiveSparseEntry

All Implemented Interfaces:
  `TarConstants`

public class TarArchiveSparseEntry extends Object implements TarConstants
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

  ### Fields inherited from interface org.apache.commons.compress.archivers.tar.TarConstants

  `ATIMELEN_GNU, ATIMELEN_XSTAR, CHKSUM_OFFSET, CHKSUMLEN, CTIMELEN_GNU, CTIMELEN_XSTAR, DEFAULT_BLKSIZE, DEFAULT_RCDSIZE, DEVLEN, FORMAT_OLDGNU, FORMAT_POSIX, FORMAT_XSTAR, GIDLEN, GNAMELEN, GNU_LONGLINK, ISEXTENDEDLEN_GNU, ISEXTENDEDLEN_GNU_SPARSE, LF_BLK, LF_CHR, LF_CONTIG, LF_DIR, LF_FIFO, LF_GNUTYPE_LONGLINK, LF_GNUTYPE_LONGNAME, LF_GNUTYPE_SPARSE, LF_LINK, LF_MULTIVOLUME, LF_NORMAL, LF_OFFSET, LF_OLDNORM, LF_PAX_EXTENDED_HEADER_LC, LF_PAX_EXTENDED_HEADER_UC, LF_PAX_GLOBAL_EXTENDED_HEADER, LF_SYMLINK, LONGNAMESLEN_GNU, MAGIC_ANT, MAGIC_GNU, MAGIC_OFFSET, MAGIC_POSIX, MAGIC_XSTAR, MAGICLEN, MAXID, MAXSIZE, MODELEN, MODTIMELEN, NAMELEN, OFFSETLEN_GNU, PAD2LEN_GNU, PREFIXLEN, PREFIXLEN_XSTAR, REALSIZELEN_GNU, SIZELEN, SPARSE_HEADERS_IN_EXTENSION_HEADER, SPARSE_HEADERS_IN_OLDGNU_HEADER, SPARSE_NUMBYTES_LEN, SPARSE_OFFSET_LEN, SPARSELEN_GNU, SPARSELEN_GNU_SPARSE, UIDLEN, UNAMELEN, VERSION_ANT, VERSION_GNU_SPACE, VERSION_GNU_ZERO, VERSION_OFFSET, VERSION_POSIX, VERSIONLEN, XSTAR_ATIME_OFFSET, XSTAR_CTIME_OFFSET, XSTAR_MAGIC_LEN, XSTAR_MAGIC_OFFSET, XSTAR_MULTIVOLUME_OFFSET, XSTAR_PREFIX_OFFSET`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TarArchiveSparseEntry(byte[] headerBuf)`
  Constructs an entry from an archive's header bytes.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<TarArchiveStructSparse>`
  `getSparseHeaders()`
  Gets information about the configuration for the sparse entry.
  `boolean`
  `isExtended()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TarArchiveSparseEntry

    public TarArchiveSparseEntry(byte[] headerBuf) throws IOException
    Constructs an entry from an archive's header bytes. File is set to null.
    Parameters:
      `headerBuf` - The header bytes from a tar archive entry.
    Throws:
      `IOException` - on unknown format

- ## Method Details

  - ### getSparseHeaders

    public List<TarArchiveStructSparse> getSparseHeaders()
    Gets information about the configuration for the sparse entry.
    Returns:
      information about the configuration for the sparse entry.
    Since:
      1.20

  - ### isExtended

    public boolean isExtended()