Class MultipartField
java.lang.Object
com.soklet.MultipartField
Encapsulates an HTML form element name, binary and
String representations of its value, and other attributes as encoded according to the multipart/form-data specification.
Instances can be acquired via these builder factory methods:
withName(String)(with form element name)with(String, byte[])(with form element name and value)
Full documentation is available at https://www.soklet.com/docs/request-handling#multipart-form-data.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classBuilder used to copy instances ofMultipartFieldviacopy(). -
Method Summary
Modifier and TypeMethodDescriptioncopy()Vends a mutable copier seeded with this instance's data, suitable for building new instances.booleanThe charset used to encode this field, if applicable.The content type for this field, if available (for example,image/pngfor an image file).Optional<byte[]> getData()The binary value of this field, if available.The value of this field represented as a string, if available.The filename associated with this field, if available.getName()The name of this field.inthashCode()toString()static MultipartField.BuilderAcquires a builder forMultipartFieldinstances.static MultipartField.BuilderAcquires a builder forMultipartFieldinstances.
-
Method Details
-
withName
Acquires a builder forMultipartFieldinstances.- Parameters:
name- the name of this field- Returns:
- the builder
-
with
Acquires a builder forMultipartFieldinstances.- Parameters:
name- the name of this fieldvalue- the optional value for this field- Returns:
- the builder
-
copy
Vends a mutable copier seeded with this instance's data, suitable for building new instances.- Returns:
- a copier for this instance
-
toString
-
equals
-
hashCode
-
getDataAsString
The value of this field represented as a string, if available.- Returns:
- the string value, or
Optional.empty()if not available
-
getName
-
getFilename
The filename associated with this field, if available.- Returns:
- the filename, or
Optional.empty()if not available
-
getContentType
The content type for this field, if available (for example,image/pngfor an image file).- Returns:
- the content type, or
Optional.empty()if not available
-
getCharset
The charset used to encode this field, if applicable.- Returns:
- the charset, or
Optional.empty()if not available
-
getData
The binary value of this field, if available.- Returns:
- the binary value, or
Optional.empty()if not available
-