Package org.zkoss.zkforge.clipboard
Class ClipboardImageResult
- java.lang.Object
-
- org.zkoss.zkforge.clipboard.ClipboardResult
-
- org.zkoss.zkforge.clipboard.ClipboardImageResult
-
public class ClipboardImageResult extends ClipboardResult
Result object for clipboard image operations containing either success data or error information.This class extends ClipboardResult to provide additional image-specific properties such as MIME type, image dimensions, and binary image data.
Success is indicated when
getError()returnsnull. UseisSuccess()for convenient success checking.
-
-
Constructor Summary
Constructors Constructor Description ClipboardImageResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetHeight()Gets the image height in pixels.byte[]getImageData()Gets the binary image data from the clipboard.StringgetMimeType()Gets the MIME type of the clipboard image.longgetSize()Gets the size of the image data in bytes.intgetWidth()Gets the image width in pixels.booleanhasImageData()Checks if this result contains valid image data.booleanisSupportedFormat()Checks if the image is of a supported format based on MIME type.
-
-
-
Method Detail
-
getMimeType
public String getMimeType()
Gets the MIME type of the clipboard image.- Returns:
- the image MIME type (e.g., "image/png", "image/jpeg"), or null if no image data
-
getImageData
public byte[] getImageData()
Gets the binary image data from the clipboard.- Returns:
- the image data as a byte array, or null if no image data or error occurred
-
hasImageData
public boolean hasImageData()
Checks if this result contains valid image data.- Returns:
- true if image data is available and the operation succeeded, false otherwise
-
getWidth
public int getWidth()
Gets the image width in pixels.- Returns:
- the image width, or 0 if not available
-
getHeight
public int getHeight()
Gets the image height in pixels.- Returns:
- the image height, or 0 if not available
-
getSize
public long getSize()
Gets the size of the image data in bytes.- Returns:
- the image size in bytes, or 0 if not available
-
isSupportedFormat
public boolean isSupportedFormat()
Checks if the image is of a supported format based on MIME type.- Returns:
- true if the image format is supported, false otherwise
-
-