Class AmexEncoder<M extends AmexMessage>

java.lang.Object
cl.netswitch.iso.amex8583.AmexEncoder<M>
Type Parameters:
M - the type of the AMEX message.

public class AmexEncoder<M extends AmexMessage> extends Object
Encodes the fields of an AmexMessage into a sequence of bytes.
  • Constructor Details

    • AmexEncoder

      public AmexEncoder(AmexFields<M> fields)
      Constructs a new AmexEncoder instance.
      Parameters:
      fields - the fields that describe a message.
      Throws:
      NullPointerException - if fields is null.
      AmexException - if required fields are not defined.
  • Method Details

    • encode

      public final byte[] encode(M message, boolean addMac)
      Encodes the fields of a message into a sequence of bytes.
      Parameters:
      message - the message that contains the field values.
      addMac - if true adds MAC bit to bitmap.
      Returns:
      the sequence of bytes with the encoded field values.
      Throws:
      NullPointerException - if message is null.
      AmexException - if an unexpected encoder error occurs.
    • preEncode

      protected void preEncode(M message, ByteArray barray)
      Called before a message is encoded into the supplied byte array.
      Parameters:
      message - the message to be encoded into barray.
      barray - the byte array containing the encoded bytes.
      Throws:
      NullPointerException - if an argument is null.
      AmexException - if an expected encoder error occurs.
    • postEncode

      protected void postEncode(M message, ByteArray barray)
      Called after a message is encoded into the supplied byte array.
      Parameters:
      message - the message to be encoded into barray.
      barray - the byte array containing the encoded bytes.
      Throws:
      NullPointerException - if an argument is null.
      AmexException - if an expected encoder error occurs.