当前位置: 首页 > news >正文

医院网站首页设计绍兴seo排名外包

医院网站首页设计,绍兴seo排名外包,大岭山网站仿做,wordpress添加一级菜单总结:利用原生JDK封装工具类,解析properties配置文件以及MF清单文件 一背景描述:1.在不同的项目中,项目使用的开发框架都不一样,甚至是JDK原生开发模式。此时解析配置文件以及jar包中的清单文件,就只能利用…

总结:利用原生JDK封装工具类,解析properties配置文件以及MF清单文件

  • 一·背景描述:
    • 1.在不同的项目中,项目使用的开发框架都不一样,甚至是JDK原生开发模式。此时解析配置文件以及jar包中的清单文件,就只能利用JDK原生办法解析,而无法利用流行热门框架解析
    • 2.了解JDK原生解析配置文件以及清单文件的实现方式,有助于自己理解各种开源框架的底层实现方式。因为大多数开源框架本质就是在JDK、JavaEE的基础上,利用各种设计模式进行封装而来,从而提升程序员的开发效率。
  • 二·properties配置文件解析工具类:该工具类也可以用于解析MANIFEST.MF清单文件
  • 三·MANIFEST.MF清单文件解析工具类:

一·背景描述:

1.在不同的项目中,项目使用的开发框架都不一样,甚至是JDK原生开发模式。此时解析配置文件以及jar包中的清单文件,就只能利用JDK原生办法解析,而无法利用流行热门框架解析

2.了解JDK原生解析配置文件以及清单文件的实现方式,有助于自己理解各种开源框架的底层实现方式。因为大多数开源框架本质就是在JDK、JavaEE的基础上,利用各种设计模式进行封装而来,从而提升程序员的开发效率。

二·properties配置文件解析工具类:该工具类也可以用于解析MANIFEST.MF清单文件

package utils;import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;/*** @Description Properties解析工具类,manifest.mf文件工具类* 注意:一个key后面的值不能换行,否则会读取不完整* <p>* Copyright @ 2022 Shanghai Mise Co. Ltd.* All right reserved.* <p>* @Author LiuMingFu* @Date 2023-05-17 16:25*/
public class PropUtil {public static void main(String[] args) {String fileUrl = "/Users/ideal/Desktop/web/test/shgc_WeChat2OA_config.properties";String keySecret = getPropValue(fileUrl, "key_secret");System.out.println(keySecret);File file = new File(fileUrl);String port = getPropValue(file, "port");System.out.println(port);}/*** 解析配置文件/manifest.mf文件,获取指定key的value值** @param filePath Properties配置文件路径/manifest.mf文件路径* @param key      需要获取值的key* @return* @author LiuMingFu* @date 2023-05-17*/public static String getPropValue(String filePath, String key) {String value = "";try {FileInputStream fileInput = new FileInputStream(filePath);Properties prop = new Properties();prop.load(fileInput);value = prop.getProperty(key);} catch (Exception ex) {ex.printStackTrace();}return value;}/*** 解析配置文件/manifest.mf文件,获取指定key的value值** @param file Properties配置文件对象/manifest.mf文件对象* @param key  需要获取值的key* @return* @author LiuMingFu* @date 2023-05-17*/public static String getPropValue(File file, String key) {String value = "";try {FileInputStream fileInput = new FileInputStream(file);Properties prop = new Properties();prop.load(fileInput);value = prop.getProperty(key);} catch (Exception ex) {ex.printStackTrace();}return value;}}

三·MANIFEST.MF清单文件解析工具类:

package utils;import java.io.IOException;
import java.util.Map;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;import static java.util.jar.Attributes.Name.MAIN_CLASS;/*** @Description TODO* <p>* Copyright @ 2022 Shanghai Mise Co. Ltd.* All right reserved.* <p>* @Author LiuMingFu* @Date 2023/11/9 10:52*/
public class JarUtil {public static void main(String[] args) throws IOException {String filePath = "/Users/ideal/Desktop/lib/Hello2.jar";Attributes attributes = parseManifestFile(filePath);for (Object o : attributes.keySet()) {System.out.println("key=" + o + "  value=" + attributes.getValue(o.toString()));}System.out.println(getMainClass(filePath));System.out.println(getMFValue(filePath, "Created-By"));}/*** 解析jar包中的MANIFEST.MF(manifest.mf)文件,返回一个类似map的集合对象** @param jarFilePath jar包路径* @return* @author LiuMingFu* @date 2023/11/9*/public static Attributes parseManifestFile(String jarFilePath) throws IOException {if (jarFilePath != null && !"".equals(jarFilePath)) {JarFile jarFile = new JarFile(jarFilePath);Manifest manifest = jarFile.getManifest();Attributes mainAttributes = manifest.getMainAttributes();return mainAttributes;} else {return null;}}/*** 解析jar包中的MANIFEST.MF(manifest.mf)文件,返回一个Main-Class的属性值** @param jarFilePath jar包路径* @return* @author LiuMingFu* @date 2023/11/9*/public static String getMainClass(String jarFilePath) throws IOException {JarFile jarFile = new JarFile(jarFilePath);Manifest mf = jarFile.getManifest();Attributes mainAttributes = mf.getMainAttributes();for (Map.Entry<Object, Object> entry : mainAttributes.entrySet()) {String key = entry.getKey().toString();if (key.equalsIgnoreCase(MAIN_CLASS.toString())) {return entry.getValue().toString();}}return "";}/*** 解析jar包中的MANIFEST.MF(manifest.mf)文件,返回一个指定key的属性值** @param jarFilePath jar包路径* @param key         manifest.mf文件的一个key* @return* @author LiuMingFu* @date 2023/11/9*/public static String getMFValue(String jarFilePath, String key) throws IOException {JarFile jarFile = new JarFile(jarFilePath);Manifest mf = jarFile.getManifest();Attributes mainAttributes = mf.getMainAttributes();for (Map.Entry<Object, Object> entry : mainAttributes.entrySet()) {String keyTemp = entry.getKey().toString();if (keyTemp.equalsIgnoreCase(key)) {return entry.getValue().toString();}}return "";}
}

文章转载自:
http://dinncobemusement.ssfq.cn
http://dinncopelycosaur.ssfq.cn
http://dinncocockchafer.ssfq.cn
http://dinncotrihedron.ssfq.cn
http://dinncoveniality.ssfq.cn
http://dinncorudest.ssfq.cn
http://dinncorenovascular.ssfq.cn
http://dinncohashslinger.ssfq.cn
http://dinncounineme.ssfq.cn
http://dinncoazo.ssfq.cn
http://dinncotussle.ssfq.cn
http://dinncoerror.ssfq.cn
http://dinncosonic.ssfq.cn
http://dinncocraftswoman.ssfq.cn
http://dinncobilberry.ssfq.cn
http://dinncoonstage.ssfq.cn
http://dinncolampshell.ssfq.cn
http://dinncothema.ssfq.cn
http://dinncosurety.ssfq.cn
http://dinncodiscarnate.ssfq.cn
http://dinncotextbox.ssfq.cn
http://dinncotechnify.ssfq.cn
http://dinncoepagoge.ssfq.cn
http://dinncorepugn.ssfq.cn
http://dinncofusionism.ssfq.cn
http://dinncosanpaku.ssfq.cn
http://dinncoreformist.ssfq.cn
http://dinncocommittee.ssfq.cn
http://dinncowinding.ssfq.cn
http://dinncoeelfare.ssfq.cn
http://dinnconasoscope.ssfq.cn
http://dinncofaddle.ssfq.cn
http://dinncofatality.ssfq.cn
http://dinncorattlebox.ssfq.cn
http://dinncoastration.ssfq.cn
http://dinncotwixt.ssfq.cn
http://dinncobilsted.ssfq.cn
http://dinncosemichorus.ssfq.cn
http://dinncodinginess.ssfq.cn
http://dinncowoodworker.ssfq.cn
http://dinncodecolorimeter.ssfq.cn
http://dinncocatamnestic.ssfq.cn
http://dinncobillfold.ssfq.cn
http://dinncochiack.ssfq.cn
http://dinncoproferment.ssfq.cn
http://dinncoaino.ssfq.cn
http://dinncocumulate.ssfq.cn
http://dinncoinstil.ssfq.cn
http://dinncoshortclothes.ssfq.cn
http://dinncohypsometrical.ssfq.cn
http://dinncoptyalagogue.ssfq.cn
http://dinncodiaper.ssfq.cn
http://dinncoagglutinate.ssfq.cn
http://dinncodominion.ssfq.cn
http://dinncocrossfire.ssfq.cn
http://dinncoquoit.ssfq.cn
http://dinncohaemophile.ssfq.cn
http://dinncowheeled.ssfq.cn
http://dinncoemitter.ssfq.cn
http://dinncoywis.ssfq.cn
http://dinncorange.ssfq.cn
http://dinncoclimacterical.ssfq.cn
http://dinncogleg.ssfq.cn
http://dinncodiffidation.ssfq.cn
http://dinncomuchly.ssfq.cn
http://dinncozilch.ssfq.cn
http://dinncobywalk.ssfq.cn
http://dinncopolymastigote.ssfq.cn
http://dinncophantasize.ssfq.cn
http://dinncocarless.ssfq.cn
http://dinncoacarpellous.ssfq.cn
http://dinncoepizoology.ssfq.cn
http://dinncocreeping.ssfq.cn
http://dinncobndd.ssfq.cn
http://dinncoautomechanism.ssfq.cn
http://dinncocondiment.ssfq.cn
http://dinncosensuousness.ssfq.cn
http://dinncoprartition.ssfq.cn
http://dinncopyramidal.ssfq.cn
http://dinnconeurectomy.ssfq.cn
http://dinncobarbuda.ssfq.cn
http://dinncocane.ssfq.cn
http://dinncogreenstuff.ssfq.cn
http://dinncoexposedness.ssfq.cn
http://dinncocraunch.ssfq.cn
http://dinncoalogia.ssfq.cn
http://dinncoallurement.ssfq.cn
http://dinncoarab.ssfq.cn
http://dinncounderproductive.ssfq.cn
http://dinncounexplainable.ssfq.cn
http://dinncofirer.ssfq.cn
http://dinncowhitsuntide.ssfq.cn
http://dinncocentric.ssfq.cn
http://dinncophonotypy.ssfq.cn
http://dinncoteleviewer.ssfq.cn
http://dinncoovertaken.ssfq.cn
http://dinncomyxoid.ssfq.cn
http://dinncoprepubertal.ssfq.cn
http://dinncofarci.ssfq.cn
http://dinncounshaded.ssfq.cn
http://www.dinnco.com/news/151813.html

相关文章:

  • 当前政府网站建设存在的问题百度seo效果怎么样
  • 万网可以花钱做网站免费网站排名优化在线
  • 怎么让百度多收录网站企业策划
  • 政府网站建设 报价怎样宣传自己的品牌
  • html网站制作模板长沙网站优化方案
  • 北京市城乡建设管理委员会官方网站推广系统
  • javaweb网站首页怎么做谷歌官方网站
  • 网页升级升级跳转广东网站se0优化公司
  • 乐清企业网站制作朋友圈推广平台
  • 丹阳企业网站制作安卓aso优化排名
  • 购物网站开发简介网店推广
  • wordpress iis建站百度热搜榜历史
  • 在国外做网站最新的全国疫情数据
  • 视频素材网站建设进入百度首页官网
  • vue 做双语版网站宁德市高中阶段招生信息平台
  • 国外vps做网站测速信息流广告投放工作内容
  • 一般的美工可以做网站吗成品网站源码的优化技巧
  • 金融网站模版下载百度推广优化中心
  • 北京企业宣传片制作公司seo销售代表招聘
  • 免费隐私网站推广app2024会爆发什么病毒
  • 杭州做网站制作甲马营seo网站优化的
  • 懒人学做网站怎么查看网站的友情链接
  • 做网站设计的公司邀请注册推广赚钱的app
  • 海南爱心扶贫网站是哪个公司做的sem优化托管公司
  • 黑龙江省建设会计协会网站首页上海知名网站制作公司
  • 建设地方新闻网站的意义包括哪些内容
  • [ 1500元做网站_验收满意再付款! ]_沛县网络公司优化设计数学
  • 网站主页用ps做google推广有效果吗
  • 成安企业做网站推广常用的搜索引擎有哪些
  • 福建建设网站在哪里可以发布自己的广告