Package org.htmlunit.util
Class KeyDataPair
- java.lang.Object
-
- org.htmlunit.util.NameValuePair
-
- org.htmlunit.util.KeyDataPair
-
- All Implemented Interfaces:
java.io.Serializable
public class KeyDataPair extends NameValuePair
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
A holder for a key/value pair that represents a file to upload.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description KeyDataPair(java.lang.String key, java.io.File file, java.lang.String fileName, java.lang.String mimeType, java.lang.String charset)Creates an instance.KeyDataPair(java.lang.String key, java.io.File file, java.lang.String fileName, java.lang.String mimeType, java.nio.charset.Charset charset)Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object object)java.nio.charset.CharsetgetCharset()Gets the charset encoding for this file upload.byte[]getData()Gets in-memory data assigned to file value.java.io.FilegetFile()java.lang.StringgetFileName()java.lang.StringgetMimeType()Gets the MIME type for this file upload.inthashCode()KeyDataPairnormalized()INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
convert null values to empty stringvoidsetData(byte[] data)Sets file value data.-
Methods inherited from class org.htmlunit.util.NameValuePair
getName, getValue, toString
-
-
-
-
Constructor Detail
-
KeyDataPair
public KeyDataPair(java.lang.String key, java.io.File file, java.lang.String fileName, java.lang.String mimeType, java.lang.String charset)Creates an instance.- Parameters:
key- the keyfile- the filefileName- the name of the filemimeType- the MIME typecharset- the charset encoding
-
KeyDataPair
public KeyDataPair(java.lang.String key, java.io.File file, java.lang.String fileName, java.lang.String mimeType, java.nio.charset.Charset charset)Creates an instance.- Parameters:
key- the keyfile- the filefileName- the name of the filemimeType- the MIME typecharset- the charset encoding
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classNameValuePair
-
hashCode
public int hashCode()
- Overrides:
hashCodein classNameValuePair
-
getFile
public java.io.File getFile()
- Returns:
- the
Fileobject if the file exists, elsenull
-
getFileName
public java.lang.String getFileName()
- Returns:
- the fileName
-
getCharset
public java.nio.charset.Charset getCharset()
Gets the charset encoding for this file upload.- Returns:
- the charset
-
getMimeType
public java.lang.String getMimeType()
Gets the MIME type for this file upload.- Returns:
- the MIME type
-
getData
public byte[] getData()
Gets in-memory data assigned to file value.- Returns:
nullif the file content should be used.
-
setData
public void setData(byte[] data)
Sets file value data. If nothing is set, the file content will be used.- Parameters:
data- byte array with file data.
-
normalized
public KeyDataPair normalized()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
convert null values to empty string Specialization of inherited method which will copy all fields and make sure that the value in the base class is not null, by calling the constructor with the current value- Overrides:
normalizedin classNameValuePair- Returns:
- a normalized copy of the
NameValuePair
-
-