List of usage examples for java.nio.file Path toAbsolutePath
Path toAbsolutePath();
From source file:io.logspace.hq.core.impl.SpacesConfiguration.java
@Bean public Spaces createSpaces() throws IOException { Path path = Paths.get(this.dataDirectory, "spaces"); this.logger.info("Using '{}' as spaces directory.", path.toAbsolutePath()); SpaceTokensFileVisitor visitor = new SpaceTokensFileVisitor(); Files.walkFileTree(path, visitor); SpacesImpl spaces = new SpacesImpl(); spaces.setSpaceTokens(visitor.getSpaceTokens()); return spaces; }
From source file:io.spikex.core.integration.MainTest.java
@Test public void testNonClustered() throws InterruptedException, IOException { Path homePath = Paths.get("build/resources/test/node1"); System.setProperty("spikex.home", homePath.toAbsolutePath().toString()); new Main().start(new String[0]); Thread.sleep(1000L);/*from w w w . j a v a 2s . com*/ }
From source file:com.digitalpebble.storm.crawler.spout.FileSpout.java
public FileSpout(String dir, String filter, Scheme scheme) { Path pdir = Paths.get(dir); List<String> f = new LinkedList<String>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(pdir, filter)) { for (Path entry : stream) { String inputFile = entry.toAbsolutePath().toString(); f.add(inputFile);// w w w . j a v a2 s . com LOG.info("Input : {}", inputFile); } } catch (IOException ioe) { LOG.error("IOException: %s%n", ioe); } _inputFiles = f.toArray(new String[f.size()]); _scheme = scheme; }
From source file:edu.jhu.hlt.concrete.ingesters.gigaword.GigawordDocumentConverter.java
public Iterator<Communication> gzToStringIterator(Path gzPath) { String pathStr = gzPath.toAbsolutePath().toString(); PersistentVector seq = (PersistentVector) this.gzToStringListFx.invoke(pathStr); return new LocalCommIterator(seq); }
From source file:com.dancorder.Archiverify.Parameters.java
private Path normalisePath(Path path) { return path.toAbsolutePath(); }
From source file:org.dawnsci.marketplace.controllers.PageController.java
@RequestMapping(value = "/pages/**", method = RequestMethod.GET) @ResponseBody//from w w w . ja va 2 s .c o m public ResponseEntity<FileSystemResource> picture(HttpServletRequest request) { String resource = ((String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE)) .substring(1); Path path = fileService.getPageFile(resource).toPath(); File file = path.toAbsolutePath().toFile(); if (file.exists() && file.isFile()) { try { String detect = tika.detect(file); MediaType mediaType = MediaType.parseMediaType(detect); return ResponseEntity.ok().contentLength(file.length()).contentType(mediaType) .body(new FileSystemResource(file)); } catch (IOException e) { e.printStackTrace(); } } else { throw new ResourceNotFoundException(); } return null; }
From source file:org.apache.tika.parser.jdbc.SQLite3DBParser.java
@Override protected String getConnectionString(InputStream is, Metadata metadata, ParseContext context) throws IOException { TikaInputStream tis = TikaInputStream.cast(is); //if this is a TikaInputStream, use that to spool is to disk or //use original underlying file. if (tis != null) { Path dbFile = tis.getPath(); return "jdbc:sqlite:" + dbFile.toAbsolutePath().toString(); } else {//from w w w .j a v a2 s . co m //if not TikaInputStream, create own tmpResources. tmpFile = Files.createTempFile("tika-sqlite-tmp", ""); Files.copy(is, tmpFile, StandardCopyOption.REPLACE_EXISTING); return "jdbc:sqlite:" + tmpFile.toAbsolutePath().toString(); } }
From source file:org.apache.tika.cli.TikaCLIBatchIntegrationTest.java
private void assertFileExists(Path path) { assertTrue("File doesn't exist: " + path.toAbsolutePath(), Files.isRegularFile(path)); }
From source file:ai.grakn.migration.base.io.MigrationOptions.java
private String resolvePath(String path) { Path givenPath = Paths.get(path); if (givenPath.isAbsolute()) { return givenPath.toAbsolutePath().toString(); }/*from w w w . j a va 2s. c o m*/ return Paths.get("").toAbsolutePath().resolve(givenPath).toString(); }
From source file:org.niord.proxy.rest.RepositoryRestService.java
/** * Returns the repository file with the given path * @param path the path/*from ww w .jav a2 s.c o m*/ * @return the repository file with the given path */ public Path getRepoFile(String path) { if (StringUtils.isBlank(path)) { return null; } // Check that the specified file is indeed under the repository root Path file = repoRoot.resolve(path); if (!file.toAbsolutePath().startsWith(repoRoot.toAbsolutePath())) { log.log(Level.WARNING, "Illegal file path not in repo root: " + file); return null; } return file; }