Here you can find the source of getFormattedDisplayName(String fileDisplayName, Path path, String baseDir)
public static String getFormattedDisplayName(String fileDisplayName, Path path, String baseDir)
//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(); } }