Class ArchivEntry
java.lang.Object
clazzfish.monitor.util.ArchivEntry
Unfortunately we can't extends URI because this is a final class. So now it
is more or less implemented as URI wrapper and is intended for the use with
zip and jar files to describe an entry inside an archive.
Historically some parts of this class were developed for a log browser for Log4J. Next it was part of the PatternTesting project. The facility to read (compressed) tar files (using org.apache.commons.compress.tar.*) was removed because we use it here only for zip and jar files.
This class is final because of performance reasons. If you need to derive it write a feature request.
- Author:
- oliver (ob@aosd.de)
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ArchivEntry
(File file) Instantiates a new archiv entry.ArchivEntry
(String scheme, File archive, String entry) Instantiates a new archiv entry.ArchivEntry
(URI uri) Instantiates a new archiv entry.ArchivEntry
(URL url) Instantiates a new archiv entry. -
Method Summary
Modifier and TypeMethodDescriptionboolean
If two entries with the same resource or class name have a different size or not the same byte code they are considered as not equal.byte[]
getBytes()
Gets the bytes.getEntry()
Gets the entry.Gets the file archiv.long
getSize()
Gets the size.Gets the zip entry.Gets the zip file.boolean
hasEntry()
Checks for entry.int
hashCode()
Hash code.boolean
isFile()
Checks if is file.toString()
To string.toURI()
To uri.
-
Constructor Details
-
ArchivEntry
-
ArchivEntry
-
ArchivEntry
-
ArchivEntry
Instantiates a new archiv entry.- Parameters:
scheme
- the schemearchive
- the archiveentry
- the entry- Throws:
URISyntaxException
- the URI syntax exception
-
-
Method Details
-
toURI
-
isFile
public boolean isFile()Checks if is file.- Returns:
- true, if is file
-
getFileArchiv
Gets the file archiv. The works of course only for JAR and ZIP files.- Returns:
- the file
-
getZipFile
Gets the zip file.- Returns:
- the zip file
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getEntry
Gets the entry. If no entry can be found an empty string is returned now. This behaviour has changed with 1.5.- Returns:
- the entry
-
hasEntry
public boolean hasEntry()Checks for entry.- Returns:
- true, if successful
-
getZipEntry
-
getSize
Gets the size.- Returns:
- the size
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getBytes
Gets the bytes.- Returns:
- the bytes
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
equals
If two entries with the same resource or class name have a different size or not the same byte code they are considered as not equal. -
hashCode
-
toString
-