src.com.ibm.as400.access.ConvTableAsciiMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jt400-jdk8 Show documentation
Show all versions of jt400-jdk8 Show documentation
The Open Source version of the IBM Toolbox for Java
///////////////////////////////////////////////////////////////////////////////
//
// JTOpen (IBM Toolbox for Java - OSS version)
//
// Filename: ConvTableAsciiMap.java
//
// The source code contained herein is licensed under the IBM Public License
// Version 1.0, which has been approved by the Open Source Initiative.
// Copyright (C) 1997-2004 International Business Machines Corporation and
// others. All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////
package com.ibm.as400.access;
/** This is the parent class for all ConvTableXXX classes that represent single-byte ASCII ccsids.
*
*/
public abstract class ConvTableAsciiMap extends ConvTable
{
private static final String copyright = "Copyright (C) 1997-2004 International Business Machines Corporation and others.";
public char[] toUnicode_ = null;
public byte[] fromUnicode_ = null;
// Constructor.
ConvTableAsciiMap(int ccsid, char[] toUnicode, char[] fromUnicode)
{
super(ccsid);
ccsid_ = ccsid;
toUnicode_ = toUnicode;
if (Trace.traceConversion_) Trace.log(Trace.CONVERSION, "Decompressing single-byte ASCII conversion table for ccsid: " + ccsid_, fromUnicode.length);
fromUnicode_ = decompressSB(fromUnicode, (byte)0x1A);
if (Trace.traceConversion_) Trace.log(Trace.CONVERSION, "Successfully loaded single-byte ASCII map for ccsid: " + ccsid_);
}
// Perform an OS/400 CCSID to Unicode conversion.
final String byteArrayToString(byte[] buf, int offset, int length, BidiConversionProperties properties)
{
if (Trace.traceConversion_) Trace.log(Trace.CONVERSION, "Converting byte array to string for ccsid: " + ccsid_, buf, offset, length);
char[] dest = new char[length];
// The 0x00FF is so we don't get any negative indices.
for (int i=0; i