Interface ArchiveEntry


  • public interface ArchiveEntry
    The entry of an archive. The life of an ArchiveEntry is dependent on the status of the ArchiveStream it came from. Once retrieved via ArchiveStream.getNextEntry(), the entry can be used as long as the ArchiveStream remains on this entry, i.e. getNextEntry() was not called, and the stream was not since closed.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long UNKNOWN_SIZE
      Special value indicating that the size is unknown
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.io.File extract​(java.io.File destination)
      Extracts the entry to the given destination directory.
      java.util.Date getLastModifiedDate()
      Returns the last modified date of the entry.
      java.lang.String getName()
      The name of the entry in the archive.
      long getSize()
      The (uncompressed) size of the entry.
      boolean isDirectory()
      Checks whether the given entry is a directory.
    • Field Detail

      • UNKNOWN_SIZE

        static final long UNKNOWN_SIZE
        Special value indicating that the size is unknown
        See Also:
        Constant Field Values
    • Method Detail

      • getName

        java.lang.String getName()
        The name of the entry in the archive. May refer to a file or directory or other item.
        Returns:
        the name of the item
      • getSize

        long getSize()
        The (uncompressed) size of the entry. May be -1 (UNKNOWN_SIZE) if the size is unknown
        Returns:
        the size of the entry once uncompressed, or -1 if unknown.
      • getLastModifiedDate

        java.util.Date getLastModifiedDate()
        Returns the last modified date of the entry.
        Returns:
        the date the entry was last modified.
      • isDirectory

        boolean isDirectory()
        Checks whether the given entry is a directory.
        Returns:
        true if the entry refers to a directory
      • extract

        java.io.File extract​(java.io.File destination)
                      throws java.io.IOException,
                             java.lang.IllegalStateException,
                             java.lang.IllegalArgumentException
        Extracts the entry to the given destination directory. The destination is expected to be a writable directory.
        Parameters:
        destination - the directory to extract the value to
        Returns:
        the extracted File
        Throws:
        java.io.IOException - propagated I/O errors by java.io
        java.lang.IllegalStateException - if the entry is out of sync with the stream
        java.lang.IllegalArgumentException - if the destination is not a directory, or a directory can not be created at the given location