Class InputSourceUtils


  • public class InputSourceUtils
    extends Object
    Utilities for working with files.
    • Method Detail

      • getFileExtension

        public static String getFileExtension​(String fileName)
        Returns the file's extension.
      • splitNameStrict

        public static String[] splitNameStrict​(String filename)
                                        throws MindeeException
        Split the filename into a name and an extension.
        Parameters:
        filename - the filename to split.
        Returns:
        first element is name, second is extension.
        Throws:
        MindeeException
      • isPdf

        public static boolean isPdf​(byte[] fileBytes)
        Returns true if the file is a PDF.
      • validateUrl

        public static void validateUrl​(URL inputUrl)
        Ensures the URL can be sent to the Mindee server.
      • hasSourceText

        public static boolean hasSourceText​(byte[] fileBytes)
        Returns true if the source PDF has source text inside. Returns false for images.
        Parameters:
        fileBytes - A byte array representing a PDF.
        Returns:
        True if at least one character exists in one page.
        Throws:
        MindeeException - if the file could not be read.