Class IsoEncoder<M extends IsoMessage>

java.lang.Object
cl.netswitch.iso.iso8583.IsoEncoder<M>
Type Parameters:
M - the type of the ISO message.

public class IsoEncoder<M extends IsoMessage> extends Object
Encodes the fields of an IsoMessage into a sequence of bytes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new IsoEncoder instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    final byte[]
    encode(M message, boolean addMac)
    Encodes the fields of a message into a sequence of bytes.
    protected void
    postEncode(M message, cl.netswitch.lib.util.ByteArray barray)
    Called after a message is encoded into the supplied byte array.
    protected void
    preEncode(M message, cl.netswitch.lib.util.ByteArray barray)
    Called before a message is encoded into the supplied byte array.

    Methods inherited from class java.lang.Object

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

    • IsoEncoder

      public IsoEncoder(IsoFields<M> fields)
      Constructs a new IsoEncoder instance.
      Parameters:
      fields - the fields that describe a message.
      Throws:
      NullPointerException - if fields is null.
      IsoException - 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.
      IsoException - if an unexpected encoder error occurs.
    • preEncode

      protected void preEncode(M message, cl.netswitch.lib.util.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.
      IsoException - if an expected encoder error occurs.
    • postEncode

      protected void postEncode(M message, cl.netswitch.lib.util.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.
      IsoException - if an expected encoder error occurs.