org.jpos.iso
Class SignedEbcdicNumberInterpreter

java.lang.Object
  extended by org.jpos.iso.SignedEbcdicNumberInterpreter
All Implemented Interfaces:
Interpreter

public class SignedEbcdicNumberInterpreter
extends Object
implements Interpreter

Implements EBCDIC Interpreter for signed numerics. (see http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ad06900_.htm) Strings are converted to and from EBCDIC bytes. Negatives will be prepended with "-" Unsigned numbers are interpreted as positive

Version:
$Revision$ $Date$
Author:
nsmith@mxgroup.net

Field Summary
static SignedEbcdicNumberInterpreter INSTANCE
          An instance of this Interpreter.
 
Constructor Summary
SignedEbcdicNumberInterpreter()
           
 
Method Summary
 int getPackedLength(int nDataUnits)
          Returns the number of bytes required to interpret a String of length nDataUnits.
 void interpret(String data, byte[] targetArray, int offset)
          Converts the string data into a different interpretation.
 String uninterpret(byte[] rawData, int offset, int length)
          Converts the byte array into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final SignedEbcdicNumberInterpreter INSTANCE
An instance of this Interpreter. Only one needed for the whole system

Constructor Detail

SignedEbcdicNumberInterpreter

public SignedEbcdicNumberInterpreter()
Method Detail

interpret

public void interpret(String data,
                      byte[] targetArray,
                      int offset)
Description copied from interface: Interpreter
Converts the string data into a different interpretation. Standard interpretations are ASCII, EBCDIC, BCD and LITERAL.

Specified by:
interpret in interface Interpreter
Parameters:
data - The data to be interpreted.

uninterpret

public String uninterpret(byte[] rawData,
                          int offset,
                          int length)
Description copied from interface: Interpreter
Converts the byte array into a String. This reverses the interpret method.

Specified by:
uninterpret in interface Interpreter
Parameters:
rawData - The interpreted data.
offset - The index in rawData to start interpreting at.
length - The number of data units to interpret.
Returns:
The uninterpreted data.

getPackedLength

public int getPackedLength(int nDataUnits)
Description copied from interface: Interpreter
Returns the number of bytes required to interpret a String of length nDataUnits.

Specified by:
getPackedLength in interface Interpreter


Copyright © 1998-2012 jPOS.org. All Rights Reserved.