Package gov.nasa.pds.tools.util
Class ImageUtil
java.lang.Object
gov.nasa.pds.tools.util.ImageUtil
A class that validate if these image files {JPEG, PNG) files are valid.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if a JPEG file is valid by inspecting the first 2 bytes for 0xffd8 and last 2 bytes for 0xffd9.booleanCheck if a PNG file is valid by inspecting if the 1st group 4 bytes are 0x89504e47 and the 2nd group of 4 bytes are 0x0d0a1a0a
-
Constructor Details
-
ImageUtil
public ImageUtil()
-
-
Method Details
-
isJPEG
Check if a JPEG file is valid by inspecting the first 2 bytes for 0xffd8 and last 2 bytes for 0xffd9.- Parameters:
jpegBase- The basename of the JPEG fileparentURL- The URL of the parent of basename- Returns:
- true if the JPEG file is valid false otherwise
- Throws:
Exception
-
isPNG
Check if a PNG file is valid by inspecting if the 1st group 4 bytes are 0x89504e47 and the 2nd group of 4 bytes are 0x0d0a1a0a- Parameters:
pngBase- The basename of the PNG fileparentURL- The URL of the parent of basename- Returns:
- true if the PNG file is valid false otherwise
- Throws:
Exception
-