com.gargoylesoftware.htmlunit.util
Class KeyDataPair

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.util.NameValuePair
      extended by com.gargoylesoftware.htmlunit.util.KeyDataPair
All Implemented Interfaces:
Serializable

public class KeyDataPair
extends NameValuePair

A holder for a key/value pair that represents a file to upload.

Version:
$Revision: 5301 $
Author:
Brad Clarke, David D. Kilzer, Mike Bowler
See Also:
Serialized Form

Constructor Summary
KeyDataPair(String key, File file, String contentType, String charset)
          Creates an instance.
 
Method Summary
 String getCharset()
          Gets the charset encoding for this file upload.
 String getContentType()
          Gets the content type for this file upload.
 byte[] getData()
          Gets in-memory data assigned to file value.
 File getFile()
           
 void setData(byte[] data)
          Sets file value data.
 
Methods inherited from class com.gargoylesoftware.htmlunit.util.NameValuePair
equals, getName, getValue, hashCode, toHttpClient, toHttpClient, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyDataPair

public KeyDataPair(String key,
                   File file,
                   String contentType,
                   String charset)
Creates an instance.

Parameters:
key - the key
file - the file
contentType - the content type
charset - the charset encoding
Method Detail

getFile

public File getFile()
Returns:
the File object if the file exists, else null

getCharset

public String getCharset()
Gets the charset encoding for this file upload.

Returns:
the charset

getContentType

public String getContentType()
Gets the content type for this file upload.

Returns:
the content type

getData

public byte[] getData()
Gets in-memory data assigned to file value.

Returns:
null if 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.


Copyright © 2002-2010 Gargoyle Software Inc.. All Rights Reserved.