Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tts-client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周亚武
tts-client
Commits
20084e57
Commit
20084e57
authored
Aug 26, 2024
by
周亚武
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改合并mp3文件规则
parent
7f2e48b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
pom.xml
pom.xml
+1
-1
src/main/java/com/mortals/xhx/tts/utils/ResourceExporter.java
...main/java/com/mortals/xhx/tts/utils/ResourceExporter.java
+34
-0
No files found.
pom.xml
View file @
20084e57
...
@@ -242,7 +242,7 @@
...
@@ -242,7 +242,7 @@
<resources>
<resources>
<resource>
<resource>
<directory>
src/main/resources
</directory>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering
>
<!-- <filtering>true</filtering>--
>
</resource>
</resource>
</resources>
</resources>
...
...
src/main/java/com/mortals/xhx/tts/utils/ResourceExporter.java
0 → 100644
View file @
20084e57
package
com.mortals.xhx.tts.utils
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.nio.file.StandardCopyOption
;
/**
* @author ZYW
* @date 2024-08-26 10:50
*/
public
class
ResourceExporter
{
public
static
void
exportResource
(
String
resourcePath
,
String
outputPath
)
throws
IOException
{
// 获取资源作为输入流
try
(
InputStream
inputStream
=
ResourceExporter
.
class
.
getClassLoader
().
getResourceAsStream
(
resourcePath
))
{
// 判断资源是否存在
if
(
inputStream
==
null
)
{
throw
new
FileNotFoundException
(
"Resource "
+
resourcePath
+
" not found"
);
}
// 输出路径转换为Path对象
Path
outputDir
=
Paths
.
get
(
outputPath
);
// 确保输出目录存在
Files
.
createDirectories
(
outputDir
);
// 输出文件的完整路径
Path
outputFile
=
outputDir
.
resolve
(
resourcePath
);
// 将资源复制到输出文件
Files
.
copy
(
inputStream
,
outputFile
,
StandardCopyOption
.
REPLACE_EXISTING
);
}
}
}
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