Record Class MultipartParser.Part

java.lang.Object
java.lang.Record
com.jsgalactic.axiom.http.MultipartParser.Part
Enclosing class:
MultipartParser

public static record MultipartParser.Part(Map<String,String> headers, String name, String filename, String contentType, long size, byte[] bytes) extends Record
One complete part: its headers, disposition parameters and bounded content.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Part(Map<String,String> headers, String name, String filename, String contentType, long size, byte[] bytes)
    Validates and copies the part's values.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Returns the value of the bytes record component.
    Returns the value of the contentType record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the filename record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the headers record component.
    Returns the value of the name record component.
    long
    Returns the value of the size record component.
    Decodes the content as UTF-8.
    text(Charset charset)
    Decodes the content with a charset.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • Part

      public Part(Map<String,String> headers, String name, String filename, String contentType, long size, byte[] bytes)
      Validates and copies the part's values.
      Parameters:
      headers - case-insensitive header map
      name - form field name, or null
      filename - file name, or null
      contentType - part Content-Type, or null
      size - content length in bytes
      bytes - content, owned by the part
  • Method Details

    • text

      public String text()
      Decodes the content as UTF-8.
      Returns:
      text of the part
    • text

      public String text(Charset charset)
      Decodes the content with a charset.
      Parameters:
      charset - charset to use
      Returns:
      text of the part
    • 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 '=='.
      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.
    • headers

      public Map<String,String> headers()
      Returns the value of the headers record component.
      Returns:
      the value of the headers record component
    • 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
    • size

      public long size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component
    • bytes

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