Package gov.nasa.pds.tools.util
Class ImageUtil
- java.lang.Object
-
- gov.nasa.pds.tools.util.ImageUtil
-
public class ImageUtil extends Object
A class that validate if these image files {JPEG, PNG) files are valid.
-
-
Constructor Summary
Constructors Constructor Description ImageUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isJPEG(String jpegBase, URL parentURL)
Check if a JPEG file is valid by inspecting the first 2 bytes for 0xffd8 and last 2 bytes for 0xffd9.boolean
isPNG(String pngBase, URL parentURL)
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
-
-
-
Method Detail
-
isJPEG
public boolean isJPEG(String jpegBase, URL parentURL) throws Exception
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
public boolean isPNG(String pngBase, URL parentURL) throws Exception
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
-
-