Package io.github.dornol.excelkit.excel
Record Class ExcelImage
java.lang.Object
java.lang.Record
io.github.dornol.excelkit.excel.ExcelImage
- Record Components:
data- the image bytes (PNG, JPEG, etc.)imageType- the image type constant fromWorkbook(e.g.,Workbook.PICTURE_TYPE_PNG,Workbook.PICTURE_TYPE_JPEG)
Represents image data to be embedded in an Excel cell.
- Since:
- 0.6.0
-
Constructor Summary
ConstructorsConstructorDescriptionExcelImage(byte[] data, int imageType) Validates that image data is not null or empty. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]data()Returns the value of thedatarecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of theimageTyperecord component.static ExcelImagejpeg(byte[] data) Creates a JPEG image.static ExcelImagepng(byte[] data) Creates a PNG image.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ExcelImage
public ExcelImage(byte[] data, int imageType) Validates that image data is not null or empty.
-
-
Method Details
-
png
Creates a PNG image.- Parameters:
data- the PNG image bytes- Returns:
- an ExcelImage with PNG type
-
jpeg
Creates a JPEG image.- Parameters:
data- the JPEG image bytes- Returns:
- an ExcelImage with JPEG type
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
data
public byte[] data()Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-
imageType
public int imageType()Returns the value of theimageTyperecord component.- Returns:
- the value of the
imageTyperecord component
-