Class TarFile

    • Constructor Detail

      • 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,
                       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​(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​(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,
                       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​(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​(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,
                       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​(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​(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 Detail

      • getEntries

        public List<TarArchiveEntry> getEntries()
        Get all TAR Archive Entries from the TarFile
        Returns:
        All entries from the tar file
      • getInputStream

        public InputStream getInputStream​(TarArchiveEntry entry)
                                   throws IOException
        Gets the input stream for the provided Tar Archive Entry.
        Parameters:
        entry - Entry to get the input stream from
        Returns:
        Input stream of the provided entry
        Throws:
        IOException - Corrupted TAR archive. Can't read entry.