Class FileHelper


  • public class FileHelper
    extends java.lang.Object
    Some File utility functions.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getExtension​(java.io.File file)  
      static java.lang.String getName​(java.io.File file)  
      static java.io.File searchSiblingWithDifferentExtension​(java.io.File file, java.lang.String[] availableExtensions)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileHelper

        public FileHelper()
    • Method Detail

      • getName

        public static java.lang.String getName​(java.io.File file)
        Parameters:
        file - the file we want its name, may be null
        Returns:
        the name of the file in arguments without its extension, never null
      • getExtension

        public static java.lang.String getExtension​(java.io.File file)
        Parameters:
        file - the file we want its extension, may be null
        Returns:
        the extension of the file in arguments, never null
      • searchSiblingWithDifferentExtension

        public static java.io.File searchSiblingWithDifferentExtension​(java.io.File file,
                                                                       java.lang.String[] availableExtensions)
        Parameters:
        file - the file for which we are looking for a specific sibling file, may be null
        availableExtensions - an array of possible extensions, may be null
        Returns:
        a file which is in the same folder as the file in argument and has the same name but with a different extension and that its extension (of the returned file) is in the availableExtensions array (case insensitive), or null if not found.