java.lang.Object
org.apache.commons.compress.archivers.tar.TarFile
All Implemented Interfaces:
Closeable, AutoCloseable

public class TarFile extends Object implements Closeable
Provides random access to UNIX archives.
Since:
1.21
  • Constructor Details

    • TarFile

      public TarFile(byte[] content) throws IOException
      Constructor for TarFile.
      Parameters:
      content - the content to use
      Throws:
      IOException - when reading the tar archive fails
    • TarFile

      public TarFile(byte[] content, boolean lenient) throws IOException
      Constructor for TarFile.
      Parameters:
      content - the content to use
      lenient - when set to true illegal values for group/userid, mode, device numbers and timestamp will be ignored and the fields set to TarArchiveEntry.UNKNOWN. When set to false such illegal fields cause an exception instead.
      Throws:
      IOException - when reading the tar archive fails
    • TarFile

      public TarFile(byte[] content, String encoding) throws IOException
      Constructor for TarFile.
      Parameters:
      content - the content to use
      encoding - the encoding to use
      Throws:
      IOException - when reading the tar archive fails
    • TarFile

      public TarFile(File archive) throws IOException
      Constructor for TarFile.
      Parameters:
      archive - the file of the archive to use
      Throws:
      IOException - when reading the tar archive fails
    • TarFile

      public TarFile(File archive, boolean lenient) throws IOException
      Constructor for TarFile.
      Parameters:
      archive - the file of the archive to use
      lenient - when set to true illegal values for group/userid, mode, device numbers and timestamp will be ignored and the fields set to TarArchiveEntry.UNKNOWN. When set to false such illegal fields cause an exception instead.
      Throws:
      IOException - when reading the tar archive fails
    • TarFile

      public TarFile(File archive, String encoding) throws IOException
      Constructor for TarFile.
      Parameters:
      archive - the file of the archive to use
      encoding - the encoding to use
      Throws:
      IOException - when reading the tar archive fails
    • TarFile

      public TarFile(Path archivePath) throws IOException
      Constructor for TarFile.
      Parameters:
      archivePath - the path of the archive to use
      Throws:
      IOException - when reading the tar archive fails
    • TarFile

      public TarFile(Path archivePath, boolean lenient) throws IOException
      Constructor for TarFile.
      Parameters:
      archivePath - the path of the archive to use
      lenient - when set to true illegal values for group/userid, mode, device numbers and timestamp will be ignored and the fields set to TarArchiveEntry.UNKNOWN. When set to false such illegal fields cause an exception instead.
      Throws:
      IOException - when reading the tar archive fails
    • TarFile

      public TarFile(Path archivePath, String encoding) throws IOException
      Constructor for TarFile.
      Parameters:
      archivePath - the path of the archive to use
      encoding - the encoding to use
      Throws:
      IOException - when reading the tar archive fails
    • TarFile

      public TarFile(SeekableByteChannel content) throws IOException
      Constructor for TarFile.
      Parameters:
      content - the content to use
      Throws:
      IOException - when reading the tar archive fails
    • TarFile

      public TarFile(SeekableByteChannel archive, int blockSize, int recordSize, String encoding, boolean lenient) throws IOException
      Constructor for TarFile.
      Parameters:
      archive - the seekable byte channel to use
      blockSize - the blocks size to use
      recordSize - the record size to use
      encoding - the encoding to use
      lenient - when set to true illegal values for group/userid, mode, device numbers and timestamp will be ignored and the fields set to TarArchiveEntry.UNKNOWN. When set to false such illegal fields cause an exception instead.
      Throws:
      IOException - when reading the tar archive fails
  • Method Details