Package com.jsgalactic.axiom.http
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 -
Method Summary
Modifier and TypeMethodDescriptionbyte[]bytes()Returns the value of thebytesrecord component.Returns the value of thecontentTyperecord component.final booleanIndicates whether some other object is "equal to" this one.filename()Returns the value of thefilenamerecord component.final inthashCode()Returns a hash code value for this object.headers()Returns the value of theheadersrecord component.name()Returns the value of thenamerecord component.longsize()Returns the value of thesizerecord component.text()Decodes the content as UTF-8.Decodes the content with a charset.final StringtoString()Returns a string representation of this record class.
-
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 mapname- form field name, or nullfilename- file name, or nullcontentType- part Content-Type, or nullsize- content length in bytesbytes- content, owned by the part
-
-
Method Details
-
text
Decodes the content as UTF-8.- Returns:
- text of the part
-
text
Decodes the content with a charset.- Parameters:
charset- charset to use- Returns:
- text of the part
-
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 '=='. -
headers
Returns the value of theheadersrecord component.- Returns:
- the value of the
headersrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
filename
Returns the value of thefilenamerecord component.- Returns:
- the value of the
filenamerecord component
-
contentType
Returns the value of thecontentTyperecord component.- Returns:
- the value of the
contentTyperecord component
-
size
public long size()Returns the value of thesizerecord component.- Returns:
- the value of the
sizerecord component
-
bytes
public byte[] bytes()Returns the value of thebytesrecord component.- Returns:
- the value of the
bytesrecord component
-