Class ArchiveEntry


  • public class ArchiveEntry
    extends MetaDataHolder
    The Class ArchiveEntry represents a single entry in a CombineArchive.
    Author:
    martin scharm
    • Constructor Detail

      • ArchiveEntry

        public ArchiveEntry​(CombineArchive archive,
                            Path relativeName,
                            URI format)
        Instantiates a new archive entry.
        Parameters:
        archive - the corresponding CombineArchive
        relativeName - the relative path name within archive
        format - the format, see CombineFormatizer
    • Method Detail

      • extractFile

        public File extractFile​(File target)
                         throws IOException
        Extract this file to target. If target is a directory we'll write to target/getFileName ().
        Parameters:
        target - the target to write this item to.
        Returns:
        the file (=target)
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • getArchive

        public CombineArchive getArchive()
        Gets the archive that contains this entry.
        Returns:
        the archive
      • isMainEntry

        public boolean isMainEntry()
        Checks if is main entry.
        Returns:
        true, if is main entry
      • getPath

        public Path getPath()
        Gets the path to this entry.

        Be aware that this path points to the entry as it is zipped in the archive. Thus, some operations might fail or result in unexpected behaviour.

        Returns:
        the path
      • getFileName

        public String getFileName()
        Gets the file name (w/o path) of this entry in the archive.
        Returns:
        the relative path name
      • getFilePath

        public String getFilePath()
        Gets the relative path name of this file in the archive.

        The path will usually start with '/', but do not rely on that. Depending on the archive it might also start with './' or without anything.

        Returns:
        the relative path name
      • getFormat

        public URI getFormat()
        Gets the format as reported by the archive's manifest.
        Returns:
        the format, see CombineFormatizer
      • setFormat

        public void setFormat​(URI format)
        Sets the format of this entry.
        Parameters:
        format - the format of this entry
      • addAllDescriptions

        public int addAllDescriptions​(File metaDataFile)
                               throws org.jdom2.JDOMException,
                                      IOException
        Add all descriptions in metaDataFile (assuming all are about this entry).
        Parameters:
        metaDataFile - the file containing the meta data
        Returns:
        number of entries added, or -1 in case of an error
        Throws:
        IOException - Signals that an I/O exception has occurred.
        org.jdom2.JDOMException - Signals problems with the jDOM parser