本文整理匯總了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));
}