Package de.unirostock.sems.cbarchive
Class ArchiveEntry
- java.lang.Object
-
- de.unirostock.sems.cbarchive.meta.MetaDataHolder
-
- de.unirostock.sems.cbarchive.ArchiveEntry
-
public class ArchiveEntry extends MetaDataHolder
The Class ArchiveEntry represents a single entry in a CombineArchive.- Author:
- martin scharm
-
-
Field Summary
-
Fields inherited from class de.unirostock.sems.cbarchive.meta.MetaDataHolder
descriptions
-
-
Constructor Summary
Constructors Constructor Description ArchiveEntry(CombineArchive archive, Path relativeName, URI format)Instantiates a new archive entry.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intaddAllDescriptions(File metaDataFile)Add all descriptions inmetaDataFile(assuming all are about this entry).FileextractFile(File target)Extract this file totarget.CombineArchivegetArchive()Gets the archive that contains this entry.StringgetEntityPath()Gets the path to this entity.FilegetFile()Deprecated.as of version 0.6, replaced by(File target)StringgetFileName()Gets the file name (w/o path) of this entry in the archive.StringgetFilePath()Gets the relative path name of this file in the archive.URIgetFormat()Gets the format as reported by the archive's manifest.PathgetPath()Gets the path to this entry.booleanisMainEntry()Checks if is main entry.voidsetFormat(URI format)Sets the format of this entry.-
Methods inherited from class de.unirostock.sems.cbarchive.meta.MetaDataHolder
addDescription, addDescription, getDescriptions, removeDescription
-
-
-
-
Constructor Detail
-
ArchiveEntry
public ArchiveEntry(CombineArchive archive, Path relativeName, URI format)
Instantiates a new archive entry.- Parameters:
archive- the corresponding CombineArchiverelativeName- the relative path name withinarchiveformat- the format, see CombineFormatizer
-
-
Method Detail
-
extractFile
public File extractFile(File target) throws IOException
Extract this file totarget. Iftargetis a directory we'll write totarget/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
-
getFile
@Deprecated public File getFile() throws IOException
Deprecated.as of version 0.6, replaced by(File target)Gets the corresponding file.- Returns:
- the file
- Throws:
IOException- Signals that an I/O exception has occurred.
-
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
-
getEntityPath
public String getEntityPath()
Gets the path to this entity. EqualsgetFilePath()for entities of typeArchiveEntry.- Specified by:
getEntityPathin classMetaDataHolder- Returns:
- the file path
-
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 inmetaDataFile(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
-
-