本文整理汇总了Java中org.apache.commons.io.FileUtils.toFile方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.toFile方法的具体用法?Java FileUtils.toFile怎么用?Java FileUtils.toFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.io.FileUtils
的用法示例。
在下文中一共展示了FileUtils.toFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AppClientUtil
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
private AppClientUtil(){
try {
Properties prop = new Properties();
FileInputStream in = new FileInputStream(FileUtils.toFile(AppClientUtil.class.getResource("/car/bjjjapis.properties")));
prop.load(in);
checksoftApi = prop.getProperty("bjjj.mobile.checksoft");
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
示例2: UserUtil
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
private UserUtil(){
try {
Properties prop = new Properties();
FileInputStream in = new FileInputStream(FileUtils.toFile(UserUtil.class.getResource("/car/bjjjapis.properties")));
prop.load(in);
getusercarlistApi = prop.getProperty("bjjj.mobile.getusercarlist");
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: shouldGenerateSameNumberOfJsonFilesAsNumberOfFeatures
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Test
public void shouldGenerateSameNumberOfJsonFilesAsNumberOfFeatures() throws Exception {
List<Feature> features = nUnitAdapter.transform(absolutePath);
File reportDir = FileUtils.toFile(NUnitAdapterTest.class.getResource("/nunit/"));
reporter.writeJsons(features, reportDir.getAbsolutePath());
assertTrue(features.size() == 1);
assertTrue(FileUtils.listFiles(new File(reportDir, Reporter.OUTPUT_FOLDER_NAME), new String[]{"json"}, false).size() == 1);
}
示例4: shouldGenerateJsonFilesInWorkingDirIfOutputDirIsBlank
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Test
public void shouldGenerateJsonFilesInWorkingDirIfOutputDirIsBlank() throws Exception {
List<Feature> features = nUnitAdapter.transform(absolutePath);
File reportDir = FileUtils.toFile(NUnitAdapterTest.class.getResource("/nunit/"));
reporter.writeJsons(features, reportDir.getAbsolutePath());
assertTrue(features.size() == 1);
assertTrue(FileUtils.listFiles(new File(reportDir, Reporter.OUTPUT_FOLDER_NAME), new String[]{"json"}, false).size() == 1);
}
示例5: getFileFromCache
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
Path getFileFromCache(String filename) throws IOException {
File src = FileUtils.toFile(getClass().getResource("/" + filename));
File destFile = new File(new File(userHome, "" + filename.hashCode()), filename);
FileUtils.copyFile(src, destFile);
return destFile.toPath();
}
示例6: getFile
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
private File getFile(String filename) {
return FileUtils.toFile(getClass().getResource("/" + filename));
}