public class ManifestUtil extends Object
Constructor and Description |
---|
ManifestUtil() |
Modifier and Type | Method and Description |
---|---|
static Manifest |
getManifest(Class<?> cls)
根据 class 获取 所在 jar 包文件的 Manifest
此方法主要利用class定位jar包,如引入hutool-all,则传入hutool中任意一个类即可获取这个jar的Manifest信息 如果这个类不在jar包中,返回 null |
static Manifest |
getManifest(File classpathItem)
获取 jar 包文件或项目目录下的 Manifest
|
static Manifest |
getManifest(JarFile jarFile)
根据
JarURLConnection 获取 jar 包文件的 Manifest |
static Manifest |
getManifest(JarURLConnection connection)
根据
JarURLConnection 获取 jar 包文件的 Manifest |
public static Manifest getManifest(Class<?> cls) throws IORuntimeException
null
cls
- 类IORuntimeException
- IO异常public static Manifest getManifest(File classpathItem) throws IORuntimeException
classpathItem
- 文件路径IORuntimeException
- IO异常public static Manifest getManifest(JarURLConnection connection) throws IORuntimeException
JarURLConnection
获取 jar 包文件的 Manifestconnection
- JarURLConnection
IORuntimeException
- IO异常public static Manifest getManifest(JarFile jarFile) throws IORuntimeException
JarURLConnection
获取 jar 包文件的 ManifestjarFile
- JarURLConnection
IORuntimeException
- IO异常Copyright © 2024. All rights reserved.