5252 * @author <a href="mailto:jefft@apache.org">Jeff Turner</a>
5353 * @author Matthew Hawthorne
5454 * @author <a href="mailto:jeremias@apache.org">Jeremias Maerki</a>
55- * @version $Id: FilenameUtils.java,v 1.10 2004/06/13 05:13:57 bayard Exp $
55+ * @version $Id: FilenameUtils.java,v 1.11 2004/06/13 05:17:11 bayard Exp $
5656 */
5757public class FilenameUtils {
5858
@@ -414,22 +414,7 @@ public static File resolveFile( File baseFile, String filename) {
414414 }
415415
416416
417-
418- // ----------------------------------------------------------------
419- // Deprecated methods
420- // ----------------------------------------------------------------
421-
422- /**
423- * Returns the filename portion of a file specification string.
424- * Matches the equally named unix command.
425- * @param filename filename to inspect
426- * @return The filename string without extension.
427- * @deprecated This method will be deleted before a 1.0 release
428- * TODO DELETE before 1.0
429- */
430- public static String basename (String filename ) {
431- return basename (filename , extension (filename ));
432- }
417+ // DEPRECATED. Though no replacement exists.
433418
434419 /**
435420 * Returns the filename portion of a file specification string.
@@ -456,128 +441,4 @@ public static String basename(String filename, String suffix) {
456441 }
457442 }
458443
459- /**
460- * Delete a file. If file is directory delete it and all sub-directories.
461- * @param file file or directory to delete.
462- * @throws IOException in case deletion is unsuccessful
463- * @deprecated Use {@link FileUtils#forceDelete(File)}
464- */
465- public static void forceDelete ( String file ) throws IOException {
466- FileUtils .forceDelete (new File (file ));
467- }
468-
469-
470-
471- /**
472- * Clean a directory without deleting it.
473- * @param directory directory to clean
474- * @throws IOException in case cleaning is unsuccessful
475- * @deprecated Use {@link FileUtils#cleanDirectory(File)}
476- */
477- public static void cleanDirectory ( String directory )
478- throws IOException {
479- FileUtils .cleanDirectory (new File (directory ));
480- }
481-
482- /**
483- * Recursively count size of a directory (sum of the length of all files).
484- *
485- * @param directory directory to inspect
486- * @return size of directory in bytes.
487- * @deprecated Use {@link FileUtils#sizeOfDirectory(File)}
488- */
489- public static long sizeOfDirectory ( String directory ) {
490- return FileUtils .sizeOfDirectory (new File (directory ));
491- }
492-
493- /**
494- * Copy file from source to destination. If <code>destinationDirectory</code> does not exist, it
495- * (and any parent directories) will be created. If a file <code>source</code> in
496- * <code>destinationDirectory</code> exists, it will be overwritten.
497- *
498- * @param source An existing <code>File</code> to copy.
499- * @param destinationDirectory A directory to copy <code>source</code> into.
500- *
501- * @throws FileNotFoundException if <code>source</code> isn't a normal file.
502- * @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory.
503- * @throws IOException if <code>source</code> does not exist, the file in
504- * <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying.
505- *
506- * @deprecated Use {@link FileUtils#copyFileToDirectory(File, File)}
507- */
508- public static void copyFileToDirectory (
509- String source ,
510- String destinationDirectory )
511- throws IOException , FileNotFoundException {
512- FileUtils .copyFileToDirectory (new File (source ), new File (destinationDirectory ));
513- }
514-
515- /**
516- * Recursively delete a directory.
517- * @param directory directory to delete
518- * @throws IOException in case deletion is unsuccessful
519- * @deprecated Use {@link FileUtils#deleteDirectory(File)}
520- */
521- public static void deleteDirectory ( String directory )
522- throws IOException {
523- FileUtils .deleteDirectory (new File (directory ));
524- }
525-
526- /**
527- * Returns the directory path portion of a file specification string.
528- * Matches the equally named unix command.
529- * @param filename filename to inspect
530- * @return The directory portion excluding the ending file separator.
531- * @deprecated Use {@link FileUtils#getPath(File)}
532- * TODO DELETE before 1.0
533- */
534- public static String dirname (String filename ) {
535- int i = filename .lastIndexOf (File .separator );
536- return (i >= 0 ? filename .substring (0 , i ) : "" );
537- }
538-
539- /**
540- * Returns the filename portion of a file specification string.
541- * @param filename filename to inspect
542- * @return The filename string with extension.
543- * @deprecated Use {@link FileUtils#removeExtension(File)}
544- * TODO DELETE before 1.0
545- */
546- public static String filename (String filename ) {
547- int i = filename .lastIndexOf (File .separator );
548- return (i >= 0 ? filename .substring (i + 1 ) : filename );
549- }
550-
551-
552-
553- /**
554- * Returns the extension portion of a file specification string.
555- * This everything after the last dot '.' in the filename (NOT including
556- * the dot).
557- * @param filename filename to inspect
558- * @return the extension
559- * @deprecated Use {@link FileUtils#getExtension(File)}
560- * TODO probably duplicate method. See getExtension
561- */
562- public static String extension (String filename ) {
563- int lastDot = filename .lastIndexOf ('.' );
564-
565- if (lastDot >= 0 ) {
566- return filename .substring (lastDot + 1 );
567- } else {
568- return "" ;
569- }
570- }
571-
572- /**
573- * Creates a file handle.
574- *
575- * @param fileName The name of the file.
576- * @return A <code>File</code> instance.
577- * @deprecated Use {@link java.io.File#Constructor(String)}
578- */
579- public static File getFile (String fileName ) {
580- return new File (fileName );
581- }
582-
583444}
0 commit comments