public static synchronized Media getWithSuffix ( Media media , String suffix ) { Check . notNull ( media ) ; Check . notNull ( suffix ) ; final String path = media . getPath ( ) ; final int dotIndex = path . lastIndexOf ( Constant . DOT ) ; if ( dotIndex > - 1 ) { return Medias . create ( path . substring ( 0 , dotIndex ) + Constant . UNDERSCORE + suffix + path . substring ( dotIndex ) ) ; } return Medias . create ( path + Constant . UNDERSCORE + suffix ) ; }
Get the media with an additional suffix just before the dot of the extension if has .