Example usage for java.nio.file Paths get

List of usage examples for java.nio.file Paths get

Introduction

In this page you can find the example usage for java.nio.file Paths get.

Prototype

public static Path get(String first, String... more) 

Source Link

Document

Converts a path string, or a sequence of strings that when joined form a path string, to a Path .

Usage

From source file:eu.project.ttc.tools.cli.TermSuiteTerminoCLI.java

/**
 * Application entry point//from   ww  w .j a v a  2  s.  co m
 * 
 * @param args
 *            Command line arguments
  * @throws UnsupportedEncodingException 
 */
public static void main(String[] args) throws Exception {
    String logPath = Paths
            .get("logs", "termsuite-" + new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date()) + ".log")
            .toAbsolutePath().toString();
    TermSuiteCLIUtils.logToFile(logPath);
    File logDir = new File("logs");
    if (!logDir.exists())
        logDir.mkdir();
    LOGGER.info("Logging to {}", logPath);
    TermSuiteTerminoCLI cli = new TermSuiteTerminoCLI();
    cli.run(args);
}

From source file:com.synflow.cx.tests.codegen.CodegenPassTests.java

@BeforeClass
public static void cleanOutput() {
    boolean cleanOutput = false;

    String tmpDir = System.getProperty("java.io.tmpdir");
    String path = Paths.get(tmpDir, OUTPUT_NAME).toString();
    try {/* www . j  av a2  s .  co  m*/
        if (cleanOutput) {
            FileUtils.deleteDirectory(new File(path));
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:com.ejisto.util.ContainerUtils.java

public static String extractAgentJar(String classPath) {
    String systemProperty = System.getProperty("ejisto.agent.jar.path");
    if (StringUtils.isNotBlank(systemProperty)) {
        return systemProperty;
    }/*  w ww  .  j  a v a 2 s  .co m*/

    final Optional<String> agentPath = Arrays.stream(classPath.split(Pattern.quote(File.pathSeparator)))
            .filter(e -> AGENT_JAR.matcher(e).matches()).findFirst();
    if (agentPath.isPresent()) {
        return Paths.get(System.getProperty("user.dir"), agentPath.get()).toString();
    }
    throw new IllegalStateException("unable to find agent jar");
}

From source file:heigit.ors.util.FileUtility.java

public static Path getResourcesPath() {
    File classFile = new File(FileUtility.class.getProtectionDomain().getCodeSource().getLocation().getFile());
    String classPath = classFile.getAbsolutePath();
    String classesPath = classPath.substring(0, classPath.indexOf("classes") + "classes".length());
    return Paths.get(classesPath, "resources");
}

From source file:org.schedulesdirect.api.utils.HttpUtils.java

static private void setupAudit() {
    try {/*from ww w .j av  a  2 s  . c o  m*/
        Path root = Paths.get(Config.get().captureRoot().getAbsolutePath(), "http");
        Files.createDirectories(root);
        AUDIT_LOG = Files.createTempFile(root,
                String.format("%s_", new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())), ".log");
        auditSetup = true;
    } catch (IOException e) {
        LOG.error("Unable to create HTTP audit log!", e);
        AUDIT_LOG = null;
    }
}

From source file:com.me.jvmi.Categories.java

private Categories(String code) {
    Path path = Paths.get("resources", "categories-" + code + ".properties");
    try (InputStream is = Files.newInputStream(path)) {
        props.load(is);//  w  ww .ja  va  2s.  co m
    } catch (IOException ex) {
        throw new RuntimeException("Failed to load properties file: " + path, ex);
    }
}

From source file:me.ryandowling.Utils.java

public static Path getDataDir() {
    return Paths.get(System.getProperty("user.dir"), "Data");
}

From source file:com.github.ffremont.microservices.springboot.node.NodeHelper.java

public Path targetJarOf(MicroServiceRest ms) {
    return Paths.get(this.targetDirOf(ms).toString(), NodeHelper.jarNameOf(ms));
}

From source file:com.twitter.heron.downloader.Extractor.java

static void extract(InputStream in, Path destination) throws IOException {
    try (final BufferedInputStream bufferedInputStream = new BufferedInputStream(in);
            final GzipCompressorInputStream gzipInputStream = new GzipCompressorInputStream(
                    bufferedInputStream);
            final TarArchiveInputStream tarInputStream = new TarArchiveInputStream(gzipInputStream)) {
        final String destinationAbsolutePath = destination.toFile().getAbsolutePath();

        TarArchiveEntry entry;/*from   www.  j  a  v  a2  s. co  m*/
        while ((entry = (TarArchiveEntry) tarInputStream.getNextEntry()) != null) {
            if (entry.isDirectory()) {
                File f = Paths.get(destinationAbsolutePath, entry.getName()).toFile();
                f.mkdirs();
            } else {
                Path fileDestinationPath = Paths.get(destinationAbsolutePath, entry.getName());

                Files.copy(tarInputStream, fileDestinationPath, StandardCopyOption.REPLACE_EXISTING);
            }
        }
    }
}

From source file:com.thesmartguild.firmloader.lib.tftp.TFTPServerFactory.java

public static TFTPServer instantiate(File file) {
    try {/*from   w w w . j av  a 2  s  . c  om*/
        TFTPServer TFTPServer_;
        Path tmpFilePath = TFTPServerFactory.createTempDirectory();
        Path filePath = Files.copy(file.toPath(), Paths.get(tmpFilePath.toString(), file.getName()),
                StandardCopyOption.REPLACE_EXISTING);
        filePath.toFile().deleteOnExit();
        TFTPServer_ = new TFTPServer(tmpFilePath.toFile(), tmpFilePath.toFile(), ServerMode.GET_ONLY);
        TFTPServer_.setLog(System.out);
        TFTPServer_.setLogError(System.out);
        return TFTPServer_;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}