Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
511e8060
Commit
511e8060
authored
Dec 23, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口文档的支持
parent
fc6b96e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
StringHelper.java
...c/main/java/com/yanzuoguang/util/helper/StringHelper.java
+2
-2
ZipHelper.java
.../src/main/java/com/yanzuoguang/util/helper/ZipHelper.java
+19
-2
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/StringHelper.java
View file @
511e8060
...
...
@@ -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
);
}
...
...
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/ZipHelper.java
View file @
511e8060
...
...
@@ -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
);
}
/**
* 讲文件添加到新目录,并且添加一个新文件
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment