## com.gargoylesoftware.htmlunit
Class KeyDataPair

    java.lang.Object
      org.apache.commons.httpclient.NameValuePair
          com.gargoylesoftware.htmlunit.KeyDataPair

All Implemented Interfaces:
  java.io.Serializable

    public class KeyDataPair

extends org.apache.commons.httpclient.NameValuePair

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

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

Constructor Summary
`KeyDataPair(java.lang.String key, java.io.File file, java.lang.String contentType, java.lang.String charset)` Creates an instance.

Method Summary
`java.lang.String` `getCharset()` Gets the charset encoding for this file upload.
`java.lang.String` `getContentType()` Gets the content type for this file upload.
`byte[]` `getData()` Gets in-memory data assigned to file value.
`java.io.File` `getFile()`
`void` `setData(byte[] data)` Sets file value data.

Methods inherited from class org.apache.commons.httpclient.NameValuePair
`equals, getName, getValue, hashCode, setName, setValue, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### KeyDataPair

    public KeyDataPair(java.lang.String key,
                       java.io.File file,
                       java.lang.String contentType,
                       java.lang.String charset)

  Creates an instance.

  Parameters:
    `key` - the key
    `file` - the file
    `contentType` - the content type
    `charset` - the charset encoding

Method Detail

### getFile

    public java.io.File getFile()

  Returns:
    the `File` object if the file exists, else `null`

### getCharset

    public java.lang.String getCharset()

  Gets the charset encoding for this file upload.

  Returns:
    the charset

### getContentType

    public java.lang.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-2011 Gargoyle Software Inc.. All Rights Reserved.