Class EbcdicPrefixer

java.lang.Object
org.jpos.iso.EbcdicPrefixer
All Implemented Interfaces:
Prefixer

public class EbcdicPrefixer extends Object implements Prefixer
EbcdicPrefixer constructs a prefix for EBCDIC messages.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final EbcdicPrefixer
    A length prefixer for up to 9 chars.
    static final EbcdicPrefixer
    A length prefixer for up to 99 chars.
    static final EbcdicPrefixer
    A length prefixer for up to 999 chars.
    static final EbcdicPrefixer
    A length prefixer for up to 9999 chars.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EbcdicPrefixer(int nDigits)
    Creates an EbcdicPrefixer with the given number of length-indicator digits.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    decodeLength(byte[] b, int offset)
    Decodes an encoded length from the byte array.
    void
    encodeLength(int length, byte[] b)
    Encodes the field length into the byte array.
    int
    Returns the number of bytes taken up by the length encoding.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • L

      public static final EbcdicPrefixer L
      A length prefixer for up to 9 chars. The length is encoded with 1 EBCDIC chars representing 1 decimal digits.
    • LL

      public static final EbcdicPrefixer LL
      A length prefixer for up to 99 chars. The length is encoded with 2 EBCDIC chars representing 2 decimal digits.
    • LLL

      public static final EbcdicPrefixer LLL
      A length prefixer for up to 999 chars. The length is encoded with 3 EBCDIC chars representing 3 decimal digits.
    • LLLL

      public static final EbcdicPrefixer LLLL
      A length prefixer for up to 9999 chars. The length is encoded with 4 EBCDIC chars representing 4 decimal digits.
  • Constructor Details

    • EbcdicPrefixer

      public EbcdicPrefixer(int nDigits)
      Creates an EbcdicPrefixer with the given number of length-indicator digits.
      Parameters:
      nDigits - number of digits used to represent the field length
  • Method Details

    • encodeLength

      public void encodeLength(int length, byte[] b)
      Description copied from interface: Prefixer
      Encodes the field length into the byte array.
      Specified by:
      encodeLength in interface Prefixer
      Parameters:
      length - the field length to encode
      b - the byte array to write the length prefix into
    • decodeLength

      public int decodeLength(byte[] b, int offset)
      Description copied from interface: Prefixer
      Decodes an encoded length from the byte array.
      Specified by:
      decodeLength in interface Prefixer
      Parameters:
      b - the byte array containing the length prefix
      offset - the offset in b where the prefix starts
      Returns:
      the length in chars of the field data to follow this prefix
    • getPackedLength

      public int getPackedLength()
      Description copied from interface: Prefixer
      Returns the number of bytes taken up by the length encoding.
      Specified by:
      getPackedLength in interface Prefixer
      Returns:
      the number of bytes used by the length encoding