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

修改类文件读取规则

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