Record Class MultipartBody.Part

java.lang.Object
java.lang.Record
cloud.opencode.base.web.body.MultipartBody.Part
Record Components:
name - the field name | 字段名
fileName - the file name (null for text fields) | 文件名(文本字段为 null)
contentType - the content type (null for text fields) | 内容类型(文本字段为 null)
data - the raw bytes | 原始字节
Enclosing class:
MultipartBody

public static record MultipartBody.Part(String name, String fileName, String contentType, byte[] data) extends Record
Multipart Part - Represents a single part in a multipart body Multipart Part - 表示 multipart 请求体中的单个 part
Since:
JDK 25, opencode-base-web V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • Part

      public Part(String name, String fileName, String contentType, byte[] data)
      Creates a Part with defensive copy of data. 创建 Part 并对数据进行防御性复制。
  • Method Details

    • data

      public byte[] data()
      Returns a defensive copy of the data. 返回数据的防御性副本。
      Returns:
      the data copy | 数据副本
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • fileName

      public String fileName()
      Returns the value of the fileName record component.
      Returns:
      the value of the fileName record component
    • contentType

      public String contentType()
      Returns the value of the contentType record component.
      Returns:
      the value of the contentType record component