public final class JkManifest
extends java.lang.Object
Manifest
providing utility methods.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUILD_JDK
The JDK version who was running while building this manifest.
|
static java.lang.String |
BUILD_TIME |
static java.lang.String |
CREATED_BY
The software that has created this manifest.
|
static java.lang.String |
IMPLEMENTATION_TITLE
The title of the implementation.
|
static java.lang.String |
IMPLEMENTATION_VENDOR
The version of the implementation.
|
static java.lang.String |
IMPLEMENTATION_VERSION
The version of the implementation.
|
static java.lang.String |
STANDARD_LOCATION
The path where generally belongs all manifest past (relative to archive root)
|
Modifier and Type | Method and Description |
---|---|
JkManifest |
addBuildInfo()
|
JkManifest |
addImplementationInfo(JkModuleId moduleId,
JkVersion version)
Adds implementation-* information to the JkManifest.
|
JkManifest |
addMainAttribute(java.util.jar.Attributes.Name key,
java.lang.String value)
Adds the specified attributes in the "main" attributes section.
|
JkManifest |
addMainAttribute(java.lang.String key,
java.lang.String value) |
JkManifest |
addMainClass(java.lang.String value)
Adds the 'Main-Class' attribute to this manifest.
|
java.lang.String |
asString() |
java.lang.String |
asTrimedString()
Returns a trimmed string representation of the manifest, removing tailing empty line
|
java.lang.String |
getMainAttribute(java.util.jar.Attributes.Name name)
Returns the value of the main attribute having the specified name.
|
java.lang.String |
getMainAttribute(java.lang.String key)
Returns the value of the main attribute having the specified name.
|
java.util.jar.Manifest |
getManifest()
Returns the underlying JDK
Manifest object. |
boolean |
isEmpty()
Returns
true if this manifest has no entry or has only
"Manifest-Version" entry. |
JkManifest |
loadFromClass(java.lang.Class<?> clazz)
Loads the manifest from the jar or the base class directory the specified class belongs to.
|
JkManifest |
loadFromFile(java.nio.file.Path file)
Loads the manifest file from the specified path and set it as the underlying manifest.
|
JkManifest |
loadFromInputStream(java.io.InputStream inputStream)
Loads the manifest from the specified input stream and set it as the underlying manifest.
|
JkManifest |
loadFromJar(java.nio.file.Path jar) |
JkManifest |
merge(java.util.jar.Manifest other)
Adds attributes of the specified manifest to this one.
|
static JkManifest |
of()
Creates an empty JkManifest
|
JkManifest |
set(java.util.jar.Manifest manifest)
Set the underlying
Manifest with the specified one. |
void |
writeTo(java.nio.file.Path file) |
void |
writeToStandardLocation(java.nio.file.Path classDir)
Writes this manifest at the standard place (META-INF/MANIFEST.MF) of the
specified directory.
|
public static final java.lang.String STANDARD_LOCATION
public static final java.lang.String BUILD_JDK
public static final java.lang.String BUILD_TIME
public static final java.lang.String CREATED_BY
public static final java.lang.String IMPLEMENTATION_TITLE
public static final java.lang.String IMPLEMENTATION_VERSION
public static final java.lang.String IMPLEMENTATION_VENDOR
public static JkManifest of()
public java.util.jar.Manifest getManifest()
Manifest
object.public JkManifest set(java.util.jar.Manifest manifest)
Manifest
with the specified one.public JkManifest loadFromFile(java.nio.file.Path file)
public JkManifest loadFromJar(java.nio.file.Path jar)
public JkManifest loadFromInputStream(java.io.InputStream inputStream)
public JkManifest loadFromClass(java.lang.Class<?> clazz)
public JkManifest addMainAttribute(java.util.jar.Attributes.Name key, java.lang.String value)
public JkManifest addMainAttribute(java.lang.String key, java.lang.String value)
#addMainAttribute(Name, String)
public JkManifest addMainClass(java.lang.String value)
public JkManifest addImplementationInfo(JkModuleId moduleId, JkVersion version)
public JkManifest addBuildInfo()
public java.lang.String getMainAttribute(java.lang.String key)
public java.lang.String getMainAttribute(java.util.jar.Attributes.Name name)
public JkManifest merge(java.util.jar.Manifest other)
public void writeToStandardLocation(java.nio.file.Path classDir)
public void writeTo(java.nio.file.Path file)
public java.lang.String asString()
public java.lang.String asTrimedString()
public boolean isEmpty()
true
if this manifest has no entry or has only
"Manifest-Version" entry.