Class ManPageFinder


  • public class ManPageFinder
    extends Object
    A utility class that gets the plain text man page for the given command. It searches (using Class.getResource()) for the pages, and returns the first one found. For any given man page multiple instances of that page can exist. Man pages are come in sections (1 through 9, 1m through 9m), locales (language, country, variant), and by command version. These instances are ordered by section number (1 - 9, 1m * - 9m), local specificity (most specific to least specific) and then by version (later versions before earlier versions). This is probably not what is wanted (I think what is wanted is versions before sections before language specificity), but is this way because of the way the Java Class.getResource() mechanism works. All methods will throw a NullPointerException if given null object arguments. All methods will throw an IllegalArgumentException if their arguments are non-null but are otherwise meaningless.
    • Method Detail

      • getCommandManPage

        public static BufferedReader getCommandManPage​(String cmdName,
                                                       String cmdClass,
                                                       Locale locale,
                                                       ClassLoader classLoader,
                                                       Logger logger)
        Get the man page for the given command for the given locale using the given classloader.
        Parameters:
        cmdName - the command name
        cmdClass - the command class
        locale - the locale to be used to find the man page
        classLoader - the class loader to be used to find the man page