ClassLoader.getSystemResourceAsStream有时只能工作

时间:2014-03-07 16:02:46

标签: java

好的,所以当我使用ClassLoader.getSystemResourceAsStream时,它只会工作,有时它会找到文件,它会返回true,然后有时会返回false,这是我的代码

InputStream ffmpegStream = ClassLoader.getSystemResourceAsStream("bin");
InputStream ffplayStream = ClassLoader.getSystemResourceAsStream("bin//ffplay.exe");
InputStream ffprobeStream = ClassLoader.getSystemResourceAsStream("bin//ffprobe.exe");

File MainConfigFile = new File(this.getMainConfigLocation());
File FFMPEGFile = new File(ffmpegStream.toString());
File FFMPEGFileInstallLocation = new File(FFMPEGInstallDirectory);
File FFPLAYFile = new File(ffplayStream.toString());
File FFPLAYFileInstallLocation = new File(FFPlayInstallDirectory);
File FFPROBEFile = new File(ffprobeStream.toString());
File FFPROBEFileInstallLocation = new File(FFProbeInstallDirectory);

FFMPEGFile.renameTo(FFMPEGFileInstallLocation);
FFPLAYFile.renameTo(FFPLAYFileInstallLocation);
FFPROBEFile.renameTo(FFPROBEFileInstallLocation);

System.out.println(FFMPEGFile.exists());
System.exit(0);

0 个答案:

没有答案