Commit 646e6d81 authored by 周亚武's avatar 周亚武

修改类文件读取规则

parent 41dcfb5a
......@@ -15,10 +15,7 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.BlockingDeque;
......@@ -273,20 +270,13 @@ public class MainWindow {
}
private void scanVoice(){
try {
ClassPathResource classPathResource = new ClassPathResource(people+"0.mp3");
File file = classPathResource.getFile();
if(file.exists()){
pushInitMsg("播音员("+speaker+")检测成功");
}else {
pushInitMsg("播音员("+speaker+")检测失败,文件不存在");
}
} catch (IOException e) {
pushInitMsg("播音员("+speaker+")检测失败 ->"+e);
throw new RuntimeException(e);
ClassLoader classLoader = MainWindow.class.getClassLoader();
InputStream inputStream = classLoader.getResourceAsStream(people+"0.mp3");
if(inputStream != null){
pushInitMsg("播音员("+speaker+")检测成功");
}else {
pushInitMsg("播音员("+speaker+")检测失败,文件不存在");
}
}
/**
......
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