Package com.mindee.input
Class InputSourceUtils
- java.lang.Object
-
- com.mindee.input.InputSourceUtils
-
public class InputSourceUtils extends Object
Utilities for working with files.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetFileExtension(String fileName)Returns the file's extension.static booleanhasSourceText(byte[] fileBytes)Returns true if the source PDF has source text inside.static booleanisPdf(byte[] fileBytes)Returns true if the file is a PDF.static String[]splitNameStrict(String filename)Split the filename into a name and an extension.static voidvalidateUrl(URL inputUrl)Ensures the URL can be sent to the Mindee server.
-
-
-
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.
-
-