Record Class DecodedJpeg

java.lang.Object
java.lang.Record
cloud.opencode.base.image.codec.jpeg.DecodedJpeg
Record Components:
width - image width in pixels (positive) | 图像宽度(像素,正整数)
height - image height in pixels (positive) | 图像高度(像素,正整数)
rgb - tightly packed RGB pixels, length width*height*3 | 紧密排列的 RGB 像素,长度为 width*height*3

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

The rgb buffer is laid out as tightly packed 8-bit RGB triples, row by row top-to-bottom, with no padding. Total length is exactly width * height * 3.

rgb 缓冲区为紧密排列的 8 位 RGB 三元组,自上而下逐行存储,无填充。 总长度恰好为 width * height * 3

Security | 安全性:

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

    Constructors
    Constructor
    Description
    DecodedJpeg(int width, int height, byte[] rgb)
    Compact constructor validating rgb length matches the dimensions.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the height record component.
    byte[]
    rgb()
    Returns the value of the rgb 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

    • DecodedJpeg

      public DecodedJpeg(int width, int height, byte[] rgb)
      Compact constructor validating rgb length matches the dimensions. 紧凑构造器,校验 rgb 长度与尺寸匹配。
  • 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
    • rgb

      public byte[] rgb()
      Returns the value of the rgb record component.
      Returns:
      the value of the rgb record component