Class NameValuePair

java.lang.Object
com.Ostermiller.util.NameValuePair

public class NameValuePair extends Object
Represents a name value pair as would be used as a CGI parameter.

More information about this class is available from ostermiller.org.

Since:
ostermillerutils 1.03.00
Author:
Stephen Ostermiller https://ostermiller.org/contact.pl?regarding=Java+Utilities
  • Constructor Details

    • NameValuePair

      public NameValuePair(String name, String value)
      Construct a name value pair.
      Parameters:
      name - name of the pair.
      value - value of the pair.
      Since:
      ostermillerutils 1.03.00
  • Method Details

    • getName

      public String getName()
      Get the name of the pair.
      Returns:
      the name of the pair.
      Since:
      ostermillerutils 1.03.00
    • getValue

      public String getValue()
      Get the value of the pair.
      Returns:
      the value of the pair.
      Since:
      ostermillerutils 1.03.00
    • toString

      public String toString()
      Get the name and value as CGI parameters, URL Encoded to UTF-8.
      Overrides:
      toString in class Object
      Returns:
      CGI appropriate representation of the pair.
      Since:
      ostermillerutils 1.03.00
    • toString

      public String toString(String charset) throws UnsupportedEncodingException
      Get the name and value as CGI parameters, URL Encoded to the given encoding.
      Parameters:
      charset - Character set to use when URL Encoding.
      Returns:
      CGI appropriate representation of the pair.
      Throws:
      UnsupportedEncodingException - if the given character set is not supported
      Since:
      ostermillerutils 1.03.00