List of usage examples for java.io File toPath
public Path toPath()
From source file:de.tudarmstadt.ukp.dkpro.core.api.datasets.internal.util.AntFileFilter.java
@Override public boolean accept(File aFile) { if (baseDir != null) { File relativeFile = baseDir.relativize(aFile.toPath()).toFile(); return accept(relativeFile.getPath()); } else {//from w w w.ja v a 2 s .c o m return accept(aFile.getPath()); } }
From source file:org.bonitasoft.web.designer.i18n.LanguagePackBuilderTest.java
private String read(File file) throws IOException { return new String(readAllBytes(file.toPath())); }
From source file:io.pivio.dependencies.SbtDependencyReader.java
private List<String> getLinesOfFile(File file) { List<String> strings; try {//from w w w. jav a 2s .c om strings = Files.readAllLines(file.toPath()); } catch (IOException e) { return new ArrayList<>(); } return strings; }
From source file:by.creepid.docsreporter.AbstractDocsReporterIT.java
protected byte[] getFileBytes(String path) { File fi = new File(path); try {/*w w w . j a v a 2s . c o m*/ return Files.readAllBytes(fi.toPath()); } catch (IOException ex) { ex.printStackTrace(); } throw new RuntimeException("Cannot set the photo"); }
From source file:com.reactive.hzdfs.dll.JarFileSharingService.java
private void moveToExtLibDir(File file) throws IOException { Files.move(file.toPath(), Paths.get(extLib).resolve(file.getName()), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.ATOMIC_MOVE); }
From source file:org.bonitasoft.web.designer.migration.LiveMigrationTest.java
private Page createPage(String version) throws IOException { folder.newFolder("pageJson"); File pageJson = folder.newFile("pageJson/pageJson.json"); write(pageJson.toPath(), format("{ \"id\": \"pageJson\", \"designerVersion\": \"%s\" }", version).getBytes()); return loader.load(pageJson.getParentFile().toPath(), pageJson.getName()); }
From source file:br.com.caelum.vraptor.observer.upload.DefaultUploadedFile.java
@Override public void writeTo(File target) throws IOException { requireNonNull(target, TARGET_CANNOT_BE_NULL); writeTo(target.toPath()); }
From source file:org.openmrs.module.owa.web.controller.OwaManageController.java
@ModelAttribute("settingsValid") public boolean settingsValid() { boolean settingsValid = false; String appFolderPath = Context.getAdministrationService().getGlobalProperty(AppManager.KEY_APP_FOLDER_PATH); if (null != appFolderPath) { File file = new File(appFolderPath); if (file.isDirectory() && Files.isWritable(file.toPath())) { settingsValid = true; }// w w w.jav a2s .c om } return settingsValid; }
From source file:org.bonitasoft.web.designer.i18n.LanguagePackBuilderTest.java
@Test public void should_ignore_files_which_are_not_po_files() throws Exception { File poFile = folder.newFile("fr.po"); folder.newFile("script.js"); write(poFile.toPath(), aSimplePoFile()); builder.start(folder.getRoot().toPath()); assertThat(folder.getRoot().list()).containsOnly("fr.po", "fr.json", "script.js"); }
From source file:com.thoughtworks.go.domain.ConsoleStreamerTest.java
private File makeConsoleFile(String... message) throws IOException { File console = File.createTempFile("console", ".log"); console.deleteOnExit();//from w ww . j a v a 2s . c o m Files.write(console.toPath(), StringUtils.join(message, "\n").getBytes()); return console; }