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

一个空间怎么放多个网站访问国外网站太慢

一个空间怎么放多个网站,访问国外网站太慢,武侯区网站建设哪里好点,网页布局的类型有哪些需求 应公司质量部要求#xff0c;需要对代码做静态检查。质量部要求#xff0c;源码文件必须在起始行起设置一些注释#xff0c;然而项目已经开发了一年之久#xff0c;且没有维护这个注释。 此时#xff0c;面对好几千个源码文件#xff0c;我们如何快速添加相应的注…需求 应公司质量部要求需要对代码做静态检查。质量部要求源码文件必须在起始行起设置一些注释然而项目已经开发了一年之久且没有维护这个注释。 此时面对好几千个源码文件我们如何快速添加相应的注释呢 对自己写一个程序来实现。 分析 假设注释模板为 /** Model: 模块* Description: 描述 * Author: 作者* Finished: 时间*/只要获得 模块 、描述、作者、时间 的值既可以通过文档读写完成给源码添加注释的需求。 代码 根据分析实现代码如下 package com.xzbd.jrx;import java.io.*; import java.nio.charset.Charset; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.List;import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.RuntimeUtil; import cn.hutool.core.util.StrUtil;public class AddFileHeaderComment {private static String projectPath D:\\workspace\\builder_backend;public static void main(String[] args) {addFileHeaderComments(projectPath);}public static void addFileHeaderComments(String projectPath) {try {Files.walkFileTree(Paths.get(projectPath), new SimpleFileVisitorPath() {Overridepublic FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {String filePath file.toString();// 仅对Java文件进行if (filePath.endsWith(.java)) {addCommentToFile(file.toFile());}return FileVisitResult.CONTINUE;}});} catch (IOException e) {e.printStackTrace();}}public static void addCommentToFile(File file) {try {String packageName getPackageName(file);String className getClassName(file);String author getAuthor(file);String date getFileModifiedDate(file);String comment String.format(/*%n * Model: %s%n * Description: %s%n * Author: %s%n * Finished: %s%n */%n%n, packageName, className, author, date);String originalContent Files.readString(file.toPath());String newContent comment originalContent;Files.write(file.toPath(), newContent.getBytes(utf-8));} catch (IOException e) {e.printStackTrace();}}public static String getPackageName(File file) throws IOException {String absolutePath file.getAbsolutePath();String sep com\\xzbd\\;String packageName StrUtil.subAfter(absolutePath, sep, false);packageName StrUtil.subBefore(packageName, File.separator, false);// 可以使用 file.getParent().getFileName(); 根据需要调整return packageName;}public static String getClassName(File file) {return file.getName().replaceFirst([.][^.]$, );}public static String getAuthor(File file) {String absolutePath file.getAbsolutePath();String cmd String.format(git --git-dir%s\\.git --work-tree%s log --reverse %s, projectPath, projectPath,absolutePath);ListString execForLines RuntimeUtil.execForLines(Charset.forName(utf-8), cmd);for (String line : execForLines) {String sep Author:;if (StrUtil.startWith(line, sep)) {String useranme StrUtil.subAfter(line, sep, false);return useranme;}}return Your Name;}public static String getFileModifiedDate(File file) {String absolutePath file.getAbsolutePath();String cmd String.format(git --git-dir%s\\.git --work-tree%s log --reverse %s, projectPath, projectPath,absolutePath);ListString execForLines RuntimeUtil.execForLines(Charset.forName(utf-8), cmd);for (String line : execForLines) {String sep Date:;if (StrUtil.startWith(line, sep)) {String dateStr StrUtil.subAfter(line, sep, false);Date data new Date(dateStr);DateTimeFormatter dateFmt DateTimeFormatter.ofPattern(yyyy年MM月dd日);String date DateUtil.format(data, dateFmt);return date;}}DateTimeFormatter dateFmt DateTimeFormatter.ofPattern(yyyy年MM月dd日);String date DateUtil.format(new Date(), dateFmt);return date;} } 执行后的效果 总结 文中代码程序实现了对java文件添加注释的功能其中用到了 hutool-all 工具其 pom 如下 dependencygroupIdcn.hutool/groupIdartifactIdhutool-all/artifactIdversion5.8.16/version/dependency另外程序也使用了 git log 查看文件的日志信息以获取文件正确的作者和完成时间。该 git 命令详解参考文章【Git】任何位置查看git日志
http://www.hkea.cn/news/14342650/

相关文章:

  • 网页网站开发平台南京网络科技公司
  • 临淄网站设计衡水seo培训
  • 长沙优化网站技巧电脑版传奇
  • asp网站源码如何做app推广
  • 网站项目开发流程图甘孜热门抖音代运营
  • 做门户网站需要什么条件专业设计网站效果
  • 创新的南昌网站设计wordpress博客访问
  • 株洲公司做网站资阳网站优化
  • 北京网站建设策划建设公司手机版的学习网站
  • 网站如何接广告产品推广网站设计
  • 做网站常用的背景图像长沙网页设计学校
  • 合肥网站建设培训机构青岛室内设计学校
  • 温州网站设计功能型网站建设
  • 做童车外贸上哪个网站3g手机网站
  • php商务网站开发刚做的网站搜全名查不到
  • 网站 建设后台服务外包主要做什么
  • 手机网站设计案例公司网站建设需推广
  • 乐清网站网站建设做汽车配件出口用什么网站好些
  • 一款蛋糕食品类企业手机网站源码网站部署步骤网站开发
  • 王建设医生网站中国造价工程建设管理协会网站
  • iis做的网站手机怎么访问百度推广需要自己做网站吗
  • 网站开发与维护是做什么工作查询企业联系方式的软件
  • 泗阳住房建设局网站制作博客网站
  • 大朗做网站在站长工具 seo综合查询
  • 连江福州网站建设网站开发与应用 大作业作业
  • 有没有帮忙做网站的pr效果做的好的网站有哪些
  • 顺昌网站建设怎样看一个网站是不是织梦做的
  • 网站config配置教程免费网站建设图书下载
  • 德阳市住房和城乡建设局网站策划公司创业计划书
  • 网站建设费属于文化事业建设费东莞樟木头做网站哪家好