Java Path File Name nio getFormattedDisplayName(String fileDisplayName, Path path, String baseDir)

Here you can find the source of getFormattedDisplayName(String fileDisplayName, Path path, String baseDir)

Description

get Formatted Display Name

License

Open Source License

Declaration

public static String getFormattedDisplayName(String fileDisplayName, Path path, String baseDir) 

Method Source Code


//package com.java2s;
import java.io.File;
import java.nio.file.Path;

public class Main {
    public static String getFormattedDisplayName(String fileDisplayName, Path path, String baseDir) {
        StringBuilder builder = new StringBuilder();
        builder.append(fileDisplayName);
        String suffix = path.toString().replace(baseDir.substring(0, baseDir.length() - 1), "")
                .replace(File.separator, "|");
        if (!suffix.startsWith("|")) {
            builder.append('|');
            builder.append(suffix);/*  w w w.j a v a 2  s  .  co  m*/
        } else {
            builder.append(suffix);
        }
        return builder.toString();
    }
}

Related

  1. getFileNameWithoutExt(final Path file)
  2. getFilePath(String dirName)
  3. getFilePathName(Path filePath)
  4. getFilePathsInFolder(String sensorName)
  5. getFilesFromDirectory(Path directory, List filenames)
  6. getFullFileName(Path path)
  7. getFullPath(String basePath, String fileName)
  8. getIndexPath(String rootDirectory, String basename)
  9. getJarContainingClass(String path, String className)