Class FileFormatFinder


  • public class FileFormatFinder
    extends Object
    Centralized Format identifier utility class. The sequential lookup rules to follow:

    1. Lookup all Formats that have case insensitive extension match OR matching mime-type that is not application/octet-stream. If none found, return Format.OctetStream.

    2. Try to find a Format where BOTH match (exclude format with null/empty extension for extension matching case)

    • if one found: return
    • if multiple found: return the first one
    • if non-found: continue

    3. Try to find a Format where the extension matches (exclude format with null/empty extension for extension matching case)

    • if one found: return
    • if multiple found: return the first one
    • if non-found: continue

    4. Try to find a Format where the mime-type matches

    • if one found: return
    • if multiple found: return the first one