Here you can find the source of getName(URI uri)
Parameter | Description |
---|---|
uri | the uri to get the name for. |
public static String getName(URI uri)
//package com.java2s; import java.net.URI; public class Main { /**// ww w.j a v a 2 s. com * Returns the name of the file that is pointed to by this URI. * * @param uri the uri to get the name for. * * @return the name of the file. */ public static String getName(URI uri) { if (uri != null) { String location = uri.getSchemeSpecificPart(); if (location != null) { String name = location; int index = location.lastIndexOf('/'); if (index != -1) { name = name.substring(index + 1, name.length()); } return name; } } return ""; } }