Record Class DecodedWebp

java.lang.Object
java.lang.Record
cloud.opencode.base.image.codec.webp.DecodedWebp
Record Components:
width - image width in pixels (positive) | 图像宽度(像素,正整数)
height - image height in pixels (positive) | 图像高度(像素,正整数)
data - tightly packed pixels matching format | 与 format 匹配的紧密排列像素
format - pixel layout describing data | 描述 data 的像素布局

public record DecodedWebp(int width, int height, byte[] data, WebpFormat format) extends Record
Result of decoding a WebP byte stream into raw pixel data. 解码 WebP 字节流后得到的原始像素结果。

The data buffer is laid out as tightly packed pixels in the order declared by format, row by row top-to-bottom, with no padding. Total length is exactly width * height * format.bytesPerPixel().

data 缓冲区按 format 声明的像素顺序紧密排列,自上而下逐行存储, 无填充。总长度恰好为 width * height * format.bytesPerPixel()

Security | 安全性:

  • Thread-safe: Conditionally — record is immutable, but the data array is shared by reference; do not mutate it. - 线程安全: 有条件 — record 不可变,但 data 数组按引用共享,请勿修改。
  • Bounds-checked: constructor enforces data.length == width * height * format.bytesPerPixel(). - 边界检查: 构造器强制 data.length == width * height * format.bytesPerPixel()
Since:
JDK 25, opencode-base-image-codec V1.0.4
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    DecodedWebp(int width, int height, byte[] data, WebpFormat format)
    Compact constructor validating data length matches the dimensions and format.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Returns the value of the data record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the format record component.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the height record component.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the width record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DecodedWebp

      public DecodedWebp(int width, int height, byte[] data, WebpFormat format)
      Compact constructor validating data length matches the dimensions and format. 紧凑构造器,校验 data 长度与尺寸、格式匹配。
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • width

      public int width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public int height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • data

      public byte[] data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component
    • format

      public WebpFormat format()
      Returns the value of the format record component.
      Returns:
      the value of the format record component