Class HexNibblesPrefixer

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

public class HexNibblesPrefixer extends Object implements Prefixer
HexNibblesPrefixer constructs a prefix storing the length in BCD.
  • Field Details

  • Constructor Details

    • HexNibblesPrefixer

      public HexNibblesPrefixer(int nDigits)
      Constructs a HexNibblesPrefixer with the given number of digits.
      Parameters:
      nDigits - number of hex nibble digits in the length prefix
  • 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