Here you can find the source of getFileName(File element)
public static String getFileName(File element)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009-2013 SKRATCHDOT.COM * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * http://www.eclipse.org/legal/epl-v10.html * /*from ww w . j a v a 2s .c o m*/ * Contributors: * JEFF |:at:| SKRATCHDOT |:dot:| COM *******************************************************************************/ import java.io.File; public class Main { public static String getFileName(File element) { String name = element.getName(); return name.length() == 0 ? element.getPath() : name; } }