Class ImageSourceFile
java.lang.Object
one.jpro.platform.image.manager.source.ImageSourceFile
- All Implemented Interfaces:
JsonConvertible,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 Summary
ConstructorsConstructorDescriptionImageSourceFile(File file) Constructs an ImageSourceFile using a given File object.ImageSourceFile(String path) Constructs an ImageSourceFile using a file path. -
Method Summary
Modifier and TypeMethodDescriptionReturns the file name associated with this image source.longReturns the identity hash code associated with this image source.Loads an image and returns it as BufferedImage.org.json.JSONObjecttoJSON()Converts the object to a JSON representation.
-
Constructor Details
-
ImageSourceFile
Constructs an ImageSourceFile using a given File object.- Parameters:
file- The File object pointing to the image.
-
ImageSourceFile
Constructs an ImageSourceFile using a file path.- Parameters:
path- The file path pointing to the image.
-
-
Method Details
-
loadImage
Description copied from interface:ImageSourceLoads an image and returns it as BufferedImage.- Specified by:
loadImagein interfaceImageSource- Returns:
- The loaded image as a BufferedImage object.
-
identityHashValue
public long identityHashValue()Description copied from interface:ImageSourceReturns the identity hash code associated with this image source.- Specified by:
identityHashValuein interfaceImageSource- Returns:
- The identity hash value corresponding to this object.
-
getFileName
Description copied from interface:ImageSourceReturns the file name associated with this image source.- Specified by:
getFileNamein interfaceImageSource- Returns:
- The file name as a string.
-
toJSON
public org.json.JSONObject toJSON()Description copied from interface:JsonConvertibleConverts the object to a JSON representation.- Specified by:
toJSONin interfaceJsonConvertible- Returns:
- A JSONObject representing the object.
-