Example usage for java.nio.file Path toString

List of usage examples for java.nio.file Path toString

Introduction

In this page you can find the example usage for java.nio.file Path toString.

Prototype

String toString();

Source Link

Document

Returns the string representation of this path.

Usage

From source file:ch.bender.evacuate.Testconstants.java

/**
 * createNewFolder//from   w  w w .jav a 2s. com
 * <p>
 * @param aParent
 * @param aNewFolderStr
 * @return
 * @throws IOException
 */
public static Path createNewFolder(Path aParent, String aNewFolderStr) throws IOException {
    Path orig = Paths.get(aParent.toString(), aNewFolderStr);
    Files.createDirectory(orig);
    return orig;
}

From source file:main.java.framework.java.measurement.MeasurementUtils.java

/**
 *
 * @param context/*from w  w w .ja v  a 2  s .c o m*/
 * @return
 */
static String getBaseDir(JavaFileScannerContext context) {
    Object baseDir = getField(context, "sonarComponents", "fs", "baseDir");
    if (baseDir == null) {
        return null;
    }
    if (baseDir instanceof Path) {
        Path projectDirectory = (Path) baseDir;
        return projectDirectory.toString();
    }
    Object dir = getField(baseDir, "path");
    if (dir instanceof String) {
        return (String) baseDir;
    }
    return null;

}

From source file:com.github.blindpirate.gogradle.util.StringUtils.java

public static String toUnixString(Path path) {
    return path.toString().replace("\\", "/");
}

From source file:io.yields.math.framework.kpi.ScoreDAO.java

private static boolean isKPIFile(Path path) {
    return path.toFile().isFile() && path.toString().endsWith(FILE_SUFFIX);
}

From source file:com.nsn.squirrel.tab.utils.PathUtils.java

/**
 * @param path/*  w  w  w.  ja va 2s  .c  o  m*/
 * @return path as string or null
 */
public static String getPath(Path path) {

    if (path != null) {
        return path.toString();
    }
    return null;
}

From source file:azkaban.execapp.AzkabanExecutorServerTest.java

private static String getSqlScriptsDir() throws IOException {
    // Dummy because any resource file works.
    URL resource = AzkabanExecutorServerTest.class.getClassLoader().getResource("test.file");
    final String dummyResourcePath = requireNonNull(resource).getPath();
    Path resources = Paths.get(dummyResourcePath).getParent();
    Path azkabanRoot = resources.getParent().getParent().getParent().getParent();

    File sqlScriptDir = Paths.get(azkabanRoot.toString(), AZKABAN_DB_SQL_PATH).toFile();
    return props.getString(AzkabanDatabaseSetup.DATABASE_SQL_SCRIPT_DIR, sqlScriptDir.getCanonicalPath());
}

From source file:cane.brothers.e4.commander.utils.PathUtils.java

/**
 * @param path// ww w.j a va  2s.  c  o m
 * @return path as string or null
 */
public static String getPath(Path path) {
    if (path != null) {
        return path.toString();
    }
    return null;
}

From source file:cn.codepub.redis.directory.RedisLockFactory.java

private static void clearLockHeld(Path realPath) {
    boolean remove = LOCK_HELD.remove(realPath.toString());
    if (!remove) {
        throw new AlreadyClosedException("Lock path was cleared but never marked as held: " + realPath);
    }//from   w w  w  .j a va 2  s  .  c o m
}

From source file:com.picklecode.popflix.App.java

private static void loadLib(String name) {

    try {//from   w  w w .j ava2  s  .  com

        if (isWindows()) {
            name = name.substring("lib".length());
        }

        String ext = getExtension();
        name = name + ext;

        LOG.info(System.getProperty("os.arch"));
        LOG.info(System.getProperty("os.name"));
        Path tmp = Files.createTempDirectory("popflix");
        setLibraryPath(tmp.toString());
        LOG.info(tmp.toString() + "/" + name);
        File fileOut = new File(tmp.toString() + "/" + name);

        LOG.info(System.getProperty("java.library.path"));

        System.out.println("/lib/" + getFolder() + "/" + name);
        InputStream in = Popflix.class.getResourceAsStream("/lib/" + getFolder() + "/" + name);
        if (in != null) {

            OutputStream out = FileUtils.openOutputStream(fileOut);
            IOUtils.copy(in, out);
            in.close();
            out.close();

        }
        System.load(fileOut.getAbsolutePath());//loading goes here
    } catch (Exception e) {
        LOG.error(e.getMessage());
        System.exit(-1);
    }
}

From source file:com.liferay.sync.engine.util.MSOfficeFileUtil.java

public static boolean isLegacyExcelFile(Path filePath) {
    String extension = FilenameUtils.getExtension(filePath.toString());

    if (extension == null) {
        return false;
    }//from w  w  w  . j  a  v  a2  s .com

    extension = extension.toLowerCase();

    if (extension.equals("xls") && !Files.isDirectory(filePath)) {
        return true;
    }

    return false;
}