com.vgrs.xcode.cmdline.common
Class NativeCmdLine

java.lang.Object
  extended by com.vgrs.xcode.cmdline.CmdLine
      extended by com.vgrs.xcode.cmdline.common.NativeCmdLine

public class NativeCmdLine
extends CmdLine

This class converts between native language encodings like Big5, S-JIS, or UTF- 8. Input data can be converted between one or more native encodings given in a space-separated list. The full list of supported encodings can be found in the Appendices section of the IDNSDK User's guide. Because of the nature of Java's support for Native Encodings, the round trip checking must be done deep inside the code. It does not, therefore need to take place here in the test driver. The encode and decode methods here just make one call, because the answer is guaranteed to be reliable.

Version:
1.0 Aug 10, 2010
Author:
nchigurupati

Field Summary
 
Fields inherited from class com.vgrs.xcode.cmdline.CmdLine
SWITCH_FILE
 
Constructor Summary
NativeCmdLine(java.lang.String[] args)
           
 
Method Summary
 java.lang.String getUsageOptions()
          Return only the options for this command.
static void main(java.lang.String[] args)
           
static void testDecode(java.io.File input, java.lang.String[] encodings)
          Use the specified native encoding to return the input sequence in UTF16 format.
static void testDecode(java.lang.String input, java.lang.String encoding)
          Use the specified native encoding to return the input sequence in UTF16 format.
static void testDecode(java.lang.String input, java.lang.String[] encodings)
          Use the specified native encoding to return the input sequence in UTF16 format.
static void testEncode(java.io.File input, java.lang.String[] encodings)
          Encodes the input in the file using each of the Java supported encoding types.
static void testEncode(java.lang.String input, java.lang.String encoding)
          Encode the input using the indicated encoding type.
static void testEncode(java.lang.String input, java.lang.String[] encodings)
          Encode the input using the indicated encoding types.
 
Methods inherited from class com.vgrs.xcode.cmdline.CmdLine
getCommandName, getOptions, setCommandName, setOptions, showUsage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NativeCmdLine

public NativeCmdLine(java.lang.String[] args)
Parameters:
args - the command line arguments
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments

testEncode

public static void testEncode(java.io.File input,
                              java.lang.String[] encodings)
Encodes the input in the file using each of the Java supported encoding types. A round-trip check is used to ensure that the encoded data is valid.

Parameters:
input - the file name of the file containing the input to be encoded.
encodings - the encoding scheme to use

testDecode

public static void testDecode(java.io.File input,
                              java.lang.String[] encodings)
Use the specified native encoding to return the input sequence in UTF16 format.

Parameters:
input - the file name of the file containing the input to be encoded.
encodings - the encoding scheme to use

testEncode

public static void testEncode(java.lang.String input,
                              java.lang.String encoding)
                       throws XcodeException
Encode the input using the indicated encoding type. A round-trip check is used to ensure that the encoded data is valid.

Parameters:
input - string to be encoded
encoding - string to indicate the encoding type of the output
Throws:
XcodeException

testEncode

public static void testEncode(java.lang.String input,
                              java.lang.String[] encodings)
                       throws XcodeException
Encode the input using the indicated encoding types. A round-trip check is used to ensure that the encoded data is valid.

Parameters:
input - the string to be encoded
encodings - indicate the encoding types of the output string
Throws:
XcodeException - if input is null or empty string or if the named charset is not supported

testDecode

public static void testDecode(java.lang.String input,
                              java.lang.String encoding)
                       throws XcodeException
Use the specified native encoding to return the input sequence in UTF16 format. This method performs round-trip checking and supports DOUBLE_UTF8.

Parameters:
input - the string to be decoded
encoding - the encoding type to be used in decoding
Throws:
XcodeException - if input is null or empty string or if the named charset is not supported

testDecode

public static void testDecode(java.lang.String input,
                              java.lang.String[] encodings)
                       throws XcodeException
Use the specified native encoding to return the input sequence in UTF16 format. This method performs round-trip checking and supports DOUBLE_UTF8.

Parameters:
input - the string to be decoded
encodings - the encoding types to be used in decoding
Throws:
XcodeException - if input is null or empty string or if the named charset is not supported

getUsageOptions

public java.lang.String getUsageOptions()
Return only the options for this command. The usage and class name are populated by the super class.

Specified by:
getUsageOptions in class CmdLine
Returns:
the usage of this command line class.


Copyright © 2000-2010 VeriSign Inc. All Rights Reserved