java.lang.Object
org.htmlunit.util.NameValuePair
org.htmlunit.util.KeyDataPair
- All Implemented Interfaces:
Serializable
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.
A holder for a key/value pair that represents a file to upload.
- Author:
- Brad Clarke, David D. Kilzer, Mike Bowler, Ahmed Ashour, Ronald Brill, Michael Lueck
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the charset encoding for this file upload.byte[]getData()Returns the in-memory data assigned to this file value, ornullif the actual file content should be used.getFile()Returns theFileobject if the file exists, otherwisenull.Returns the file name.Returns the MIME type for this file upload.inthashCode()INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
convert null values to empty stringvoidsetData(byte[] data) Sets the in-memory data for this file value.Methods inherited from class org.htmlunit.util.NameValuePair
getName, getValue, toString
-
Constructor Details
-
KeyDataPair
Creates an instance.- Parameters:
key- the keyfile- the filefileName- the name of the filemimeType- the MIME typecharset- the charset encoding name
-
KeyDataPair
Creates an instance.- Parameters:
key- the keyfile- the filefileName- the name of the filemimeType- the MIME typecharset- the charset encoding
-
-
Method Details
-
equals
- Overrides:
equalsin classNameValuePair
-
hashCode
public int hashCode()- Overrides:
hashCodein classNameValuePair
-
getFile
Returns theFileobject if the file exists, otherwisenull.- Returns:
- the file, or
nullif it does not exist
-
getFileName
Returns the file name.- Returns:
- the file name
-
getCharset
Returns the charset encoding for this file upload.- Returns:
- the charset
-
getMimeType
Returns the MIME type for this file upload.- Returns:
- the MIME type
-
getData
public byte[] getData()Returns the in-memory data assigned to this file value, ornullif the actual file content should be used.- Returns:
- the in-memory data, or
null
-
setData
public void setData(byte[] data) Sets the in-memory data for this file value. If not set, the file content will be used.- Parameters:
data- the byte array with file data
-
normalized
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
convert null values to empty string Specialization of the inherited method that copies all fields and ensures the value in the base class is notnull.- Overrides:
normalizedin classNameValuePair- Returns:
- a normalized copy of the
NameValuePair
-