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
     
  • Method Summary

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ImageUtil

      public ImageUtil()
  • Method Details

    • 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 file
      parentURL - 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 file
      parentURL - The URL of the parent of basename
      Returns:
      true if the PNG file is valid false otherwise
      Throws:
      Exception