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

什么网站程序做资料库南昌网站建设培训班

什么网站程序做资料库,南昌网站建设培训班,温岭 网站制作,网络营销师证书需要多少钱抽象 是否曾经需要分解WAR文件以及分解WAR文件中的所有JAR文件#xff1f; 是的#xff0c;我也是#xff01; 我写了Ferris-war-exploder来爆炸#xff1a; 一个JAR文件 一个WAR文件#xff0c;它找到的每个JAR文件也会爆炸。 包含每个JAR文件#xff08;请参阅 是的我也是 我写了Ferris-war-exploder来爆炸 一个JAR文件 一个WAR文件它找到的每个JAR文件也会爆炸。 包含每个JAR文件请参阅1和WAR文件请参阅2的EAR文件也爆炸了。 基本上ferris-war-exploder会爆炸任何ZIP文件格式的东西。 ZIP格式的所有条目也会被分解。 这是递归发生的因此任何可以爆炸的东西都会爆炸。 免责声明 这篇文章仅供参考。 在使用所提供的任何信息之前请认真思考。 从中学到东西但最终自己做出决定风险自负。 要求 我使用以下主要技术完成了本文的所有工作。 您可能可以使用不同的技术或版本来做相同的事情但不能保证。 NetBeans 11.2 Maven 3.3.9与NetBeans捆绑在一起 Java 11zulu11.35.15-ca-jdk11.0.5-win_x64 下载 访问我的GitHub页面https://github.com/mjremijan以查看我所有的开源项目。 这篇文章的代码位于 https : //github.com/mjremijan/ferris-war-exploder 让我们开始吧 ferris-war-exploder会爆炸任何ZIP文件格式的文件。 ZIP格式的所有条目也会被分解。 这是递归发生的因此任何可以爆炸的东西都会爆炸。 您需要告诉它爆炸的档案WARJAREARZIP。 您需要告诉它在哪里爆炸存档。 注意一旦WAR爆炸请参阅我的ferris-magic-number来分析所有.class文件。 清单1显示了启动应用程序的main()方法。 我有两个示例爆炸一个JAR和爆炸一个WAR。 清单1 – public class Main { public static void main(String[] args) throws Exception { System.out.printf( Welcome to Ferris WAR Exploder %n ); new Unzip( ./src/test/jars/commons-lang3-3.7.jar , ./target/unzipped/jar ) .unzip(); new Unzip( ./src/test/wars/sample.war , ./target/unzipped/war ) .unzip(); System.out.printf( %n DONE %n ); } } 清单2显示了Unzip类。 此类包含有趣的代码以递归方式分解档案。 清单2中的所有内容都不难理解因此请您自己阅读。 清单2 – package org.ferris.war.exploder; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; /** * * author Michael Remijan mjremijanyahoo.com mjremijan */ public class Unzip { protected File zipFile; protected File destinationDirectory; public Unzip(String zipFilePath, String destinationDirectoryPath) { setZipFile(zipFilePath); setDestinationDirectory(destinationDirectoryPath); } public Unzip(File zipFile) { this .zipFile zipFile; setDestinationDirectory(zipFile.getParent()); } protected void setDestinationDirectory(String destinationDirectoryPath) { destinationDirectory new File(destinationDirectoryPath, zipFile.getName()); if (destinationDirectory.exists() destinationDirectory.isDirectory()) { throw new RuntimeException( String.format( The destination directory \%s\ already exists. , destinationDirectory.getPath() ) ); } if (destinationDirectory.exists() destinationDirectory.isFile()) { destinationDirectory new File(destinationDirectoryPath, zipFile.getName() .d ); } mkdirs(destinationDirectory, Failed to create the destination directory \%s\. ); } protected void setZipFile(String zipFilePath) { zipFile new File(zipFilePath); if (!zipFile.exists()) { throw new RuntimeException( String.format( The file \%s\ does not exist , zipFile.getPath() ) ); } if (!zipFile.canRead()) { throw new RuntimeException( String.format( The file \%s\ is not readable , zipFile.getPath() ) ); } } protected void unzip() throws Exception { System.out.printf( %n Unipping %s %n%n , zipFile.getPath()); try (ZipInputStream zip new ZipInputStream( new FileInputStream(zipFile)); ){ for (ZipEntry z zip.getNextEntry(); z ! null ; z zip.getNextEntry()) { if (z.isDirectory()) { mkdirs( new File(destinationDirectory, z.getName()), Failed to create a zip entry directory \%s\ ); } else { File zfile new File(destinationDirectory, z.getName()); mkdirs(zfile.getParentFile(), Failed to create parent directory for zip entry file \%s\. ); File unzippedFile unzipEntry(z, zip); if (isZip(unzippedFile)) { new Unzip(unzippedFile).unzip(); } } } } } protected boolean isZip(File file) { boolean b false ; try { b new ZipFile(file).getName().length() 0 ; } catch (IOException ignore) {} return b; } protected File unzipEntry(ZipEntry z, ZipInputStream zip) throws Exception { File zfile new File(destinationDirectory, z.getName()); System.out.printf( %s%n , zfile.getAbsolutePath()); try ( FileOutputStream out new FileOutputStream(zfile)) { zip.transferTo(out); } zip.closeEntry();; return zfile; } protected void mkdirs(File dir, String errorMessageFormat) { if (dir.exists() dir.isDirectory()) { return ; } dir.mkdirs(); if (!dir.exists()) { throw new RuntimeException( String.format(errorMessageFormat, dir.getPath() ) ); } } } 摘要 ferris-war-exploder项目并不太复杂但是当您需要完全爆炸WAR或EAR归档文件时它非常方便。 请享用 参考文献 ZipOutputStream。 nd。 甲骨文 从https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/zip/ZipOutputStream.html检索。 翻译自: https://www.javacodegeeks.com/2020/03/explode-a-war-file-recursively.html
http://www.pierceye.com/news/660349/

相关文章:

  • 找人做微信网站无锡响应式网站
  • 温州手机网站制作联系电话装修公司加盟条件
  • 网站后台模板html5淄博桓台网站建设公司
  • 开发app和网站的公司网站开发项目流程图模板
  • 深圳优秀网站建设品牌策略
  • 上海市建设机械行业协会网站石家庄最新招聘
  • Wordpress垂直类目站模版建设官网入口
  • 网站建设发布平台网络界面设计
  • rss 网站插件国内哪个网站做水产比较大
  • 做营销看的网站有哪些内容芜湖做网站推广有哪些公司
  • 网站建设岗位说明新网金商网站
  • 网站域名使用费多少正规抖音代运营公司排名
  • 网站建设后需要交费吗物流公司电话
  • 网站建设 福州wordpress静态文件目录下
  • 鸿顺里网站建设汕头网站排名优化报价
  • 揭阳自助建站软件社区网站建设资金申请
  • 牟平做网站衡水网页网站建设
  • 蒙文门户网站建设phpok企业建站系统
  • 域名注册网站的域名哪里来的楚雄建网站
  • 专门教ps的网站简单的app开发制作
  • 电商网站建设综述湖北seo网站设计
  • 南京做网站营销网站后台忘记账号密码
  • 敦化建设局网站饰品做国际贸易哪些网站
  • 网站做js跳转怎么创建公司
  • 网站建设合同需要交印花税吗怎么做网站卖美瞳
  • 小程序价格为什么比网站建设高自定义wordpress的实用技巧
  • 企业网站模板源码有哪些报价网站制作
  • 网站建设与网页设计实训报告二级建造师建设云网站
  • 网站后缀gov汕头网站建设小程序
  • 一个空间做多个网站wordpress大改动