public static Optional < String > getFileName ( final String aUrl ) { if ( aUrl != null ) { int index = aUrl . lastIndexOf ( ' ' ) ; if ( index > 0 ) { final String file = aUrl . substring ( index + 1 ) ; if ( file . contains ( "." ) ) { return Optional . of ( file ) ; } } } return Optional . empty ( ) ; }
returns the file name of the url .