Commit 511e8060 authored by yanzg's avatar yanzg

接口文档的支持

parent fc6b96e0
......@@ -1032,13 +1032,13 @@ public class StringHelper {
* @return 处理后的值对象
*/
public static String getCodeString(String from, Object target) {
String regex = "\\{.*?\\}";
String regex = "\\{(.*?)\\}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(from);
// 寻找到的代码片段 不包含分括号
while (m.find()) {
String name = m.group();
String name = m.group(1);
String value = StringHelper.getFirst(ObjectHelper.getString(target, name), EMPTY);
from = from.replace(name, value);
}
......
......@@ -30,13 +30,14 @@ public class ZipHelper {
/**
* @param dirFile
* @param zipFile
* @param isDir 是否显示最下级相对目录
* @throws IOException
* @创建日期:2018年5月4日 下午3:07:55
* @作者: meter
* @描述:压缩指定目录下所有文件
* @Title: zipDirectory
*/
public static void zipDirectory(File dirFile, File zipFile) throws IOException {
public static void zipDirectory(File dirFile, File zipFile, boolean isDir) throws IOException {
if (dirFile == null) {
throw new CodeException("压缩时文件夹对象不能为空。");
}
......@@ -46,7 +47,10 @@ public class ZipHelper {
if (zipFile == null) {
zipFile = new File(dirFile.getAbsolutePath() + ".zip");
}
String dirName = dirFile.getName() + File.separator;
String dirName = StringHelper.EMPTY;
if (isDir) {
dirName = dirFile.getName() + File.separator;
}
// 创建zip输出流
ZipOutputStream zipOutStream = new ZipOutputStream(new FileOutputStream(zipFile), Charset.forName("UTF-8"));
try {
......@@ -63,6 +67,19 @@ public class ZipHelper {
}
}
/**
* @param dirFile
* @param zipFile
* @throws IOException
* @创建日期:2018年5月4日 下午3:07:55
* @作者: meter
* @描述:压缩指定目录下所有文件
* @Title: zipDirectory
*/
public static void zipDirectory(File dirFile, File zipFile) throws IOException {
zipDirectory(dirFile, zipFile, false);
}
/**
* 讲文件添加到新目录,并且添加一个新文件
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment