Here you can find the source of getFilename(final Path path)
Parameter | Description |
---|---|
path | the path that you which to get the filename as a string |
public static String getFilename(final Path path)
//package com.java2s; //License from project: Open Source License import java.nio.file.Path; public class Main { /**//from w ww .j ava 2 s . co m * Needed to get rid of findbugs "dodgy code warnings" in regards to getting the filename of a path as a string * * @param path the path that you which to get the filename as a string * @return the filename or an empty string */ public static String getFilename(final Path path) { String filename = ""; if (path != null) { final Path filenamePath = path.getFileName(); if (filenamePath != null) { filename = filenamePath.toString(); } } return filename; } }