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:com.liferay.sync.engine.util.FileUtilTest.java

@Test
public void testGetFilePath() {
    FileSystem fileSystem = FileSystems.getDefault();

    Path filePath = FileUtil.getFilePath("test", "test");

    Assert.assertEquals("test" + fileSystem.getSeparator() + "test", filePath.toString());
}

From source file:eu.itesla_project.online.tools.RunTDSimulation.java

private Path getFile(Path folder, String filename) {
    if (folder != null)
        return Paths.get(folder.toString(), filename);
    return Paths.get(filename);
}

From source file:fr.duminy.jbackup.core.BackupConfiguration.java

public void addSource(Path sourceDirectory, String dirFilter, String fileFilter) {
    Source source = new Source();
    source.setPath(sourceDirectory.toString());
    source.setDirFilter(dirFilter);/* w  ww  .  j av a 2  s .  c o m*/
    source.setFileFilter(fileFilter);
    sources.add(source);
}

From source file:caillou.company.clonemanager.gui.service.task.impl.CloneManagerIOExceptionAdvice.java

@After("execution(* caillou.company.clonemanager.background.service.impl.FileVisitor.visitFileFailed(..)) && args(path, exception)")
public void handleFailedToVisit(Path path, IOException exception) {
    String message = this.getErrorMessageForIOException(path);
    CloneManagerIOException cloneManagerIOException = new CloneManagerIOException(message,
            exception.getMessage(), path.toString());
    CloneManagerIOExceptionBean.getReadingErrors().add(cloneManagerIOException);
}

From source file:com.thinkbiganalytics.util.TableType.java

public String deriveLocationSpecification(Path tableLocation, String source, String entity) {

    Validate.notNull(tableLocation, "tableLocation expected");
    Validate.notNull(source, "source expected");
    Validate.notNull(entity, "entity expected");

    Path path = tableLocation.resolve(source).resolve(entity).resolve(tableSuffix);
    String location = path.toString().replace(":/", "://");

    StringBuffer sb = new StringBuffer();
    sb.append(" LOCATION '");

    sb.append(location).append("'");

    return sb.toString();
}

From source file:hydrograph.server.execution.tracking.utils.ExecutionTrackingUtils.java

private FileInputStream getExternalPropertyFilePath() {
    int index = 0;
    String dirPath = "";
    FileInputStream fileInputStream = null;
    try {/*from w w  w.j  a v  a  2  s.  com*/
        Path path = Paths.get(HydrographMain.class.getProtectionDomain().getCodeSource().getLocation().toURI());
        String filePath = path.toString();
        index = filePath.lastIndexOf(File.separator);
        dirPath = filePath.substring(0, index) + File.separator + PROPERTY_FILE;

        File file = new File(dirPath);
        if (file.exists()) {
            fileInputStream = new FileInputStream(file);
        }
    } catch (URISyntaxException exception) {
        logger.error("File Path does not exist:" + dirPath, exception);
    } catch (FileNotFoundException exception) {
        logger.error("File not found: " + dirPath, exception);
    }
    return fileInputStream;
}

From source file:io.cloudslang.intellij.lang.completion.macro.CurrentNamespaceMacro.java

private String fixNamespace(final String projectPath, final String filePath) {
    // Exclude file name from namespace value
    Path relativePath = get(projectPath).relativize(get(new File(filePath).getParent()));
    int nameCount = relativePath.getNameCount();
    if ((nameCount <= 0) || StringUtils.isEmpty(relativePath.toString())) {
        return DEFAULT_NAMESPACE_TO_USE;
    }/*from  w w w.  j  a  va  2  s .c o  m*/
    StringBuilder strBuilder = new StringBuilder(relativePath.toString().length());
    int nameCountMinusOne = nameCount - 1;
    for (int index = 0; index < nameCount; index++) {
        String cleanPart = fixPathPart(relativePath.getName(index).toString());
        if (isNotEmpty(cleanPart)) {
            strBuilder.append(cleanPart.toLowerCase(ENGLISH)); // namespace should be lowercase
            if (index < nameCountMinusOne) {
                strBuilder.append(NAMESPACE_SEPARATOR);
            }
        }
    }
    return strBuilder.toString();
}

From source file:de.kaixo.mubi.lists.store.MubiListsToElasticSearchLoader.java

public void loadAllFromDir(Path dir) {
    try {/* ww w .  ja v a 2s.c o m*/
        Files.newDirectoryStream(dir, "*.json").forEach(this::loadFromJson);
    } catch (IOException e) {
        logger.error("Failing to process " + dir.toString());
    }
}

From source file:org.wso2.appserver.integration.tests.aarservice.CARBON15383VoidServiceMethodTestCase.java

@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init(userMode);
    serverManager = new ServerConfigurationManager(asServer);
    // load the custom axis2 config
    Path axis2configFileLocation = Paths.get(TestConfigurationProvider.getResourceLocation(), "artifacts", "AS",
            "axismepconfig", "axis2.xml");
    File axis2Config = new File(axis2configFileLocation.toString());

    serverManager.applyConfiguration(axis2Config);
    super.init(userMode);
}

From source file:edu.cmu.tetrad.cli.search.FgsdCli.java

@Override
public List<DataValidation> getDataValidations(DataSet dataSet, Path dirOut, String filePrefix) {
    List<DataValidation> validations = new LinkedList<>();

    String outputDir = dirOut.toString();
    if (!skipUniqueVarName) {
        if (validationOutput) {
            validations.add(new UniqueVariableNames(dataSet,
                    Paths.get(outputDir, filePrefix + "_duplicate_var_name.txt")));
        } else {// w  ww. j a  v  a 2  s  .c o m
            validations.add(new UniqueVariableNames(dataSet));
        }
    }
    if (!skipCategoryLimit) {
        validations.add(new LimitDiscreteCategory(dataSet, CATEGORY_LIMIT));
    }

    return validations;
}