Package com.norconex.commons.lang.jar
Class JarFile
java.lang.Object
com.norconex.commons.lang.jar.JarFile
- All Implemented Interfaces:
Comparable<JarFile>
Simple Jar file representation holding name and version information.
- Since:
- 1.10.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanintbooleangetPath()Deprecated.inthashCode()booleanisDuplicateOf(JarFile jarFile) Gets whether a jar file is considered a duplicate of this one.booleanisEquivalentTo(JarFile other) Gets whether this jar file is equivalent to the other if they both have the same semantic version and last modified date.booleanisGreaterOrEquivalentTo(JarFile other) Gets whether this jar file is greater or equivalent to the other, by comparing semantic versions and last modified dates.booleanisGreaterThan(JarFile other) Gets whether this jar file is greater than the other, by comparing semantic versions and last modified dates.booleanisLowerOrEquivalentTo(JarFile other) Gets whether this jar file is lower or equivalent to the other.booleanisLowerThan(JarFile other) Gets whether this jar file lower than the other, by comparing semantic versions and last modified dates.booleanisSameVersion(JarFile jarFile) Deprecated.UseisEquivalentTo(JarFile)instead.booleanisSameVersionAndTime(JarFile jarFile) Deprecated.UseisEquivalentTo(JarFile)instead.booleanisVersionGreaterThan(JarFile file) toFile()Returns this jar file as aFile.toJarFiles(File... jarPaths) Returns the supplied paths as a list ofJarFile.toJarFiles(Path... jarPaths) Returns the supplied paths as a list ofJarFile.toJarFiles(Collection<Path> jarPaths) Returns the supplied paths as a list ofJarFile.toString()
-
Field Details
-
FILTER
-
-
Constructor Details
-
JarFile
-
-
Method Details
-
toFile
Returns this jar file as aFile.- Returns:
- file
- Since:
- 3.0.0
-
getPath
Deprecated.UsetoFile()instead.Gets this jar file as aFile.- Returns:
- a file
-
getFullName
-
getBaseName
-
getVersion
-
getLastModified
-
isVersionGreaterThan
-
toString
-
isSameVersion
Deprecated.UseisEquivalentTo(JarFile)instead.Gets whether this Jar has the same name and version as the provided jar.- Parameters:
jarFile- jar file- Returns:
trueif the jar names and versions are the same.- Since:
- 1.13.0
-
isDuplicateOf
Gets whether a jar file is considered a duplicate of this one. Two jar files are duplicates if they share the same base name, regardless of their version or last modified dates. Equivalent jars are always duplicates, but duplicates are not always equivalent.- Parameters:
jarFile- the jar file to test- Returns:
trueif the jar file is a duplicate- Since:
- 3.0.0
- See Also:
-
isSameVersionAndTime
Deprecated.UseisEquivalentTo(JarFile)instead.Gets whether this Jar has the same name and version as the provided jar, as well as the same last modified date.- Parameters:
jarFile- jar file- Returns:
trueif the jar names, versions and last modified dates are the same.- Since:
- 1.13.0
-
isEquivalentTo
Gets whether this jar file is equivalent to the other if they both have the same semantic version and last modified date. An equivalent jar is always considered a duplicates (same base names), but duplicates are not always equivalent.- Parameters:
other- other jar file we are comparing to- Returns:
trueif this jar file is equivalent to the other- See Also:
-
isGreaterThan
Gets whether this jar file is greater than the other, by comparing semantic versions and last modified dates.- Parameters:
other- other jar file we are comparing to- Returns:
trueif this jar file is greater than the other
-
isGreaterOrEquivalentTo
Gets whether this jar file is greater or equivalent to the other, by comparing semantic versions and last modified dates.- Parameters:
other- other jar file we are comparing to- Returns:
trueif this jar file is greater or equivalent to the other
-
isLowerThan
Gets whether this jar file lower than the other, by comparing semantic versions and last modified dates.- Parameters:
other- other jar file we are comparing to- Returns:
trueif this jar file is lower than the other
-
isLowerOrEquivalentTo
Gets whether this jar file is lower or equivalent to the other.- Parameters:
other- other jar file we are comparing to- Returns:
trueif this jar file is lower or equivalent to the other
-
compareTo
- Specified by:
compareToin interfaceComparable<JarFile>
-
toJarFiles
Returns the supplied paths as a list ofJarFile. The paths can be any combination of jar files or directories of jar files (does not recurse). A jar file is interpreted to be a file with the ".jar" extension. Files with different extensions are ignored.- Parameters:
jarPaths- paths to jar files or directories containing jar files- Returns:
- a list of jar files or an empty list, never
null. - Throws:
UncheckedIOException- if a problem occurs while accessing files- Since:
- 3.0.0
-
toJarFiles
Returns the supplied paths as a list ofJarFile. The paths can be any combination of jar files or directories of jar files (does not recurse). A jar file is interpreted to be a file with the ".jar" extension. Files with different extensions are ignored.- Parameters:
jarPaths- paths to jar files or directories containing jar files- Returns:
- a list of jar files or an empty list, never
null. - Throws:
UncheckedIOException- if a problem occurs while accessing files- Since:
- 3.0.0
-
toJarFiles
Returns the supplied paths as a list ofJarFile. The paths can be any combination of jar files or directories of jar files (does not recurse). A jar file is interpreted to be a file with the ".jar" extension. Files with different extensions are ignored.- Parameters:
jarPaths- paths to jar files or directories containing jar files- Returns:
- a list of jar files or an empty list, never
null. - Throws:
UncheckedIOException- if a problem occurs while accessing files- Since:
- 3.0.0
-
equals
-
canEqual
-
hashCode
public int hashCode()
-
toFile()instead.