ca.idms.io
Class NativeCodePage

java.lang.Object
  extended by ca.idms.io.TraceObject
      extended by ca.idms.io.NativeCodePage
All Implemented Interfaces:
Trace

public class NativeCodePage
extends TraceObject

This class supports the Country Extended Code Table feature. The IDMS and Datacom ODBC drivers use code tables created by the CECP editor for conversion between ASCII and EBCDIC. Normally the Native data conversion classes in this package use the built in Java CharToByte and ByteToChar converter classes, which support an extensive set of character encodings. This class can be used for simple conversion when the JRE on the client machine does not have the full set of converter classes. The table is created on Windows using the IDMS Server Code Page Editor application, and read in binary format on all platforms, including z/OS. All character fields are expected to be in ASCII.

Version:
1.01, 10/13/05
Author:
Dave Ross

Field Summary
static boolean debug
          Use CECP instead of Java converter class.
static java.lang.String DEBUG
          Property key to enable debug.
static boolean network
          Try to use CECP before the server specified network encoding.
static java.lang.String NETWORK
          Property key to enable use for network encoding.
 
Fields inherited from class ca.idms.io.TraceObject
exclude, EXCLUDE, FALSE, include, INCLUDE, logWriter, PREFIX, PROPERTIES_FILE, PROPERTIES_KEY, snap, SNAP, SNAP_BYTES, SNAP_NATIVE, SNAP_OBJECT, SNAP_SQL, snapBytes, snapNative, snapObject, snapSql, stub, trace, TRACE, TRACE_FILE, TRACE_LIFE, TRACE_NATIVE, TRACE_PRODUCT, traceLife, traceNative, traceStream, TRUE
 
Constructor Summary
NativeCodePage(java.lang.String s)
          Creates a new code page object from a table file in the classpath.
 
Method Summary
 byte[] getBytes(java.lang.String s)
          Convert a string to EBCDIC bytes.
 java.lang.String getString(byte[] b)
          Convert EBCDIC bytes to a string.
 java.lang.String getString(byte[] b, int o, int l)
          Convert EBCDIC bytes to a string.
 
Methods inherited from class ca.idms.io.TraceObject
finalize, get, getBoolean, getClasses, getInteger, getProperty, listProperties, message, parseList, print, print, print, println, println, snap, snap, snap, snap, snap, snap, snap, toHex, toHex, toHex, toHex, toHex, toString, trace, trace, trace, trace, trace, trace, traceEntry, unloadProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final java.lang.String DEBUG
Property key to enable debug.

See Also:
Constant Field Values

NETWORK

public static final java.lang.String NETWORK
Property key to enable use for network encoding.

See Also:
Constant Field Values

debug

public static boolean debug
Use CECP instead of Java converter class. This should only be used for debugging only.

See Also:
DEBUG

network

public static boolean network
Try to use CECP before the server specified network encoding. This can be specified to avoid data conversion by the server when the requested code page is available on the client.

See Also:
NETWORK
Constructor Detail

NativeCodePage

public NativeCodePage(java.lang.String s)
Creates a new code page object from a table file in the classpath. For compatibility with existing code, any errors reading the file are deferred until the converter is actually used.

Parameters:
s - the file name containing the code pages.
Method Detail

getBytes

public byte[] getBytes(java.lang.String s)
                throws java.io.UnsupportedEncodingException
Convert a string to EBCDIC bytes.

Parameters:
s - string assumed to be just ASCII
Returns:
EBCDIC equivalent
Throws:
java.io.UnsupportedEncodingException - if the table was not loaded or not a single byte character

getString

public java.lang.String getString(byte[] b)
                           throws java.io.UnsupportedEncodingException
Convert EBCDIC bytes to a string.

Parameters:
b - array of EBCDIC bytes
Returns:
Java String equivalent
Throws:
java.io.UnsupportedEncodingException - if the table was not loaded

getString

public java.lang.String getString(byte[] b,
                                  int o,
                                  int l)
                           throws java.io.UnsupportedEncodingException
Convert EBCDIC bytes to a string.

Parameters:
b - array of EBCDIC bytes
o - start offset in array
l - length to convert
Returns:
Java String equivalent
Throws:
java.io.UnsupportedEncodingException - if the table was not loaded


Copyright © 2009 CA, All rights reserved