com.vgrs.xcode.ext
Class Convert

java.lang.Object
  extended by com.vgrs.xcode.ext.Convert

public class Convert
extends java.lang.Object

This routine converts directly between Race, Punycode and Native forms, abstracting any intermediate steps. For instance, it is possible for calling applications to convert a domain name from Race to Punycode and UTF8 using a single call.

Note:
Data conversions involving "Race" and "Punycode" rely on the underlying Idna object. Encoding to "Race" or "Punycode" always applies the Nameprep algorithm. Decoding from "Race" or "Punycode" may optionally apply Nameprep dependant on the toUnicodeRoundTripCheckFlag of the Idna object. Conversions to and from all other data types do not include the Nameprep algorithm, and are allowed to contain data not valid for IDN registration.


Field Summary
static java.lang.String PUNYCODE_ENCODING
          A string refering to the Punycode algorithm referenced in RFC 3492.
static java.lang.String RACE_ENCODING
          A string refering to the Row-based ASCII Compatible Encoding.
 
Constructor Summary
Convert()
          Construct a new Convert object to transform a single input sequence into one or more encoding forms.
Convert(Idna aRace, Idna aPunycode)
          Construct a new Convert object to transform a single input sequence into one or more encoding forms.
Convert(Idna aRace, Idna aPunycode, UnicodeFilter aUnicodeFilter)
          Construct a new Convert object to transform a single input sequence into one or more encoding forms.
Convert(Punycode aPunycode, Race aRace)
          Construct a new Convert object to transform a single input sequence into one or more encoding forms.
Convert(Punycode aPunycode, Race aRace, boolean aToUnicodeExceptionFlag)
          Construct a new Convert object to transform a single input sequence into one or more encoding forms.
Convert(Punycode aPunycode, Race aRace, boolean aToUnicodeExceptionFlag, boolean aIsRegistrationProtocol)
          Construct a new Convert object to transform a single input sequence into one or more encoding forms.
 
Method Summary
 java.lang.String execute(java.lang.String aInput, java.lang.String aInputType, java.lang.String aOutputType)
          Convert the input sequence into a new encoding form.
 java.util.Properties execute(java.lang.String aInput, java.lang.String aInputType, java.lang.String[] aOutputTypes)
          Convert the input sequence into one or more encoding forms.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RACE_ENCODING

public static final java.lang.String RACE_ENCODING
A string refering to the Row-based ASCII Compatible Encoding.
This variable is hard coded to the value "RACE".

See Also:
Constant Field Values

PUNYCODE_ENCODING

public static final java.lang.String PUNYCODE_ENCODING
A string refering to the Punycode algorithm referenced in RFC 3492.
This variable is hard coded to the value "PUNYCODE".

See Also:
Constant Field Values
Constructor Detail

Convert

public Convert()
        throws XcodeException
Construct a new Convert object to transform a single input sequence into one or more encoding forms.

Throws:
XcodeException

Convert

public Convert(Punycode aPunycode,
               Race aRace)
        throws XcodeException
Construct a new Convert object to transform a single input sequence into one or more encoding forms.

Parameters:
aPunycode - An Ace object for converting to and from Punycode.
aRace - An Ace object for converting to and from Race.
Throws:
XcodeException - If the parameters are null or invalid.

Convert

public Convert(Punycode aPunycode,
               Race aRace,
               boolean aToUnicodeExceptionFlag)
        throws XcodeException
Construct a new Convert object to transform a single input sequence into one or more encoding forms.

Parameters:
aPunycode - An Ace object for converting to and from Punycode.
aRace - An Ace object for converting to and from Race.
aToUnicodeExceptionFlag - (see the Idna object for details)
Throws:
XcodeException - If the parameters are null or invalid.

Convert

public Convert(Punycode aPunycode,
               Race aRace,
               boolean aToUnicodeExceptionFlag,
               boolean aIsRegistrationProtocol)
        throws XcodeException
Construct a new Convert object to transform a single input sequence into one or more encoding forms.

Parameters:
aPunycode - An Ace object for converting to and from Punycode.
aRace - An Ace object for converting to and from Race.
aToUnicodeExceptionFlag - (see the Idna object for details)
Throws:
XcodeException - If the parameters are null or invalid.

Convert

public Convert(Idna aRace,
               Idna aPunycode,
               UnicodeFilter aUnicodeFilter)
Construct a new Convert object to transform a single input sequence into one or more encoding forms.

Parameters:
aRace - An Idna object for converting to and from Race.
aPunycode - An Idna object for converting to and from Punycode.
aUnicodeFilter - A UnicodeFilter object to applied to the input sequence before encoding.
Throws:
XcodeException - If the parameters are null or invalid.

Convert

public Convert(Idna aRace,
               Idna aPunycode)
Construct a new Convert object to transform a single input sequence into one or more encoding forms.

Parameters:
aRace - An Idna object for converting to and from Race.
aPunycode - An Idna object for converting to and from Punycode.
Throws:
XcodeException - If the parameters are null or invalid.
Method Detail

execute

public java.lang.String execute(java.lang.String aInput,
                                java.lang.String aInputType,
                                java.lang.String aOutputType)
                         throws XcodeException
Convert the input sequence into a new encoding form.

Parameters:
aInput - the string to be converted
aInputType - the encoding type of the input string
aOutputType - the desired output encoding
Returns:
A Properties object containing the results of all transformations. Each key matches a String from otype and each value is the associated encoded form.
Throws:
XcodeException - if either the input string is invalid or the itype/otype is not supported

execute

public java.util.Properties execute(java.lang.String aInput,
                                    java.lang.String aInputType,
                                    java.lang.String[] aOutputTypes)
                             throws XcodeException
Convert the input sequence into one or more encoding forms.

Note:
The Convert logic ignores XcodeExceptions when attempting to convert to multiple output encodings. Output encodings for which the conversion fails are not included in the result set. This implies that XcodeExceptions such as UNSUPPORTED_ENCODING are hidden from the user unless the call asks specifically for a conversion to exactly one encoding. This logic improves the efficiency of the algorithm, and is not generally problematic.

Parameters:
aInput - the string to be converted
aInputType - the encoding type of the input string
aOutputTypes - the String array of desired output encodings
Returns:
A Properties object containing the results of all transformations. Each key matches a String from otype and each value is the associated encoded form.
Throws:
XcodeException - On invalid input parameters


Copyright © 2000-2010 VeriSign Inc. All Rights Reserved