Java Path File Name nio getName(Path path)

Here you can find the source of getName(Path path)

Description

Returns the name of the file or directory from the given path.

License

Open Source License

Parameter

Parameter Description
path the path to the file or directory.

Return

the name of the file or directory.

Declaration

public static String getName(Path path) 

Method Source Code

//package com.java2s;

import java.nio.file.*;

public class Main {
    /**//from ww w  . j  a  v a  2  s  .  c o m
     * Returns the name of the file or directory from the given path.
     *
     * @param path the path to the file or directory.
     * @return the name of the file or directory.
     */
    public static String getName(Path path) {
        return path.getFileName().toString();
    }
}

Related

  1. getLocalFilePath(String localDirectory, String filename)
  2. getManifestProperty(Path pathToJar, String propertyName)
  3. getName(Path file)
  4. getName(Path path)
  5. getName(Path path)
  6. getName(String path)
  7. getNamePart(Path file)
  8. getNameWithoutSuffix(Path path)
  9. getNormalizedFileName(Path file)