public final class JkManifest
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUILD_JDK
The JDK version who was running while bulding this manifest.
|
static java.lang.String |
CREATED_BY
The software that has created this manifest.
|
static java.lang.String |
PATH
The path where generally belongs all manifest past (relative to archive
asScopedDependency)
|
Modifier and Type | Method and Description |
---|---|
JkManifest |
addAutodetectMain(java.nio.file.Path classDir)
Adds the main class entry by auto-detecting the class holding the main method.
|
JkManifest |
addContextualInfo()
|
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 |
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 |
merge(JkManifest other)
Adds attributes of the specified manifest to this one.
|
static JkManifest |
of(java.io.InputStream inputStream)
Creates a
JkManifest from the specified input getOutputStream. |
static JkManifest |
of(java.util.jar.Manifest manifest)
Creates a JkManifest from the specified
Manifest object. |
static JkManifest |
of(java.nio.file.Path manifestFile)
Creates a
JkManifest from the specified file. |
static JkManifest |
ofClassDir(java.nio.file.Path classDir)
Creates a
JkManifest from the specified class dir. |
static JkManifest |
ofEmpty()
Returns an empty manifest containing only the "Manifest-Version=1.0"
attribute.
|
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 PATH
public static final java.lang.String BUILD_JDK
public static final java.lang.String CREATED_BY
public static JkManifest of(java.util.jar.Manifest manifest)
Manifest
object.public static JkManifest of(java.nio.file.Path manifestFile)
JkManifest
from the specified file. The file is
supposed to be a manifest file. If the manifest file does not exist, an
IllegalArgumentException
is thrown.public static JkManifest ofClassDir(java.nio.file.Path classDir)
JkManifest
from the specified class dir. This
method looks at the META-INF/MANIFEST.MF file inside the specified
directory to create the returned manifest. If no such file is found, an
empty manifest is returned.public static JkManifest of(java.io.InputStream inputStream)
JkManifest
from the specified input getOutputStream. The
specified getOutputStream is supposed to contains manifest information as present
in a manifest file.public static JkManifest ofEmpty()
public JkManifest addMainAttribute(java.util.jar.Attributes.Name key, java.lang.String value)
public JkManifest addAutodetectMain(java.nio.file.Path classDir)
public JkManifest addMainAttribute(java.lang.String key, java.lang.String value)
#addMainAttribute(Name, String)
public JkManifest addMainClass(java.lang.String value)
public JkManifest addContextualInfo()
public java.lang.String getMainAttribute(java.lang.String key)
public java.lang.String getMainAttribute(java.util.jar.Attributes.Name name)
public JkManifest merge(JkManifest other)
public void writeTo(java.nio.file.Path file)
public void writeToStandardLocation(java.nio.file.Path classDir)
public java.util.jar.Manifest getManifest()
Manifest
object.public boolean isEmpty()
true
if this manifest has no entry or has only
"Manifest-Version" entry.