java.lang.Object
one.jpro.platform.image.manager.source.ImageSourceFile
All Implemented Interfaces:
JsonConvertible, ImageSource

public class ImageSourceFile extends Object implements ImageSource
Represents an image source based on a file. This class is used to load images from local files and perform various operations related to the image file, such as computing a hash value and converting its details to JSON.
See Also:
  • Constructor Details

    • ImageSourceFile

      public ImageSourceFile(File file)
      Constructs an ImageSourceFile using a given File object.
      Parameters:
      file - The File object pointing to the image.
    • ImageSourceFile

      public ImageSourceFile(String path)
      Constructs an ImageSourceFile using a file path.
      Parameters:
      path - The file path pointing to the image.
  • Method Details

    • loadImage

      public BufferedImage loadImage()
      Description copied from interface: ImageSource
      Loads an image and returns it as BufferedImage.
      Specified by:
      loadImage in interface ImageSource
      Returns:
      The loaded image as a BufferedImage object.
    • identityHashValue

      public long identityHashValue()
      Description copied from interface: ImageSource
      Returns the identity hash code associated with this image source.
      Specified by:
      identityHashValue in interface ImageSource
      Returns:
      The identity hash value corresponding to this object.
    • getFileName

      public String getFileName()
      Description copied from interface: ImageSource
      Returns the file name associated with this image source.
      Specified by:
      getFileName in interface ImageSource
      Returns:
      The file name as a string.
    • toJSON

      public org.json.JSONObject toJSON()
      Description copied from interface: JsonConvertible
      Converts the object to a JSON representation.
      Specified by:
      toJSON in interface JsonConvertible
      Returns:
      A JSONObject representing the object.