Class BASE1Header

java.lang.Object
org.jpos.iso.header.BaseHeader
org.jpos.iso.header.BASE1Header
All Implemented Interfaces:
Serializable, Cloneable, ISOHeader, Loggeable

public class BASE1Header extends BaseHeader
BASE1 header implementation.
  0 hlen;         Fld  1: Header Length        1B      (Byte     0)
  1 hformat;      Fld  2: Header Format        8N,bit  (Byte     1)
  2 format;       Fld  3: Text Format          1B      (Byte     2)
  3 len[2];       Fld  4: Total Message Length 2B      (Byte  3- 4)
  5 dstId[3];     Fld  5: Destination Id       6N,BCD  (Byte  5- 7)
  8 srcId[3];     Fld  6: Source Id            6N,BCD  (Byte  8-10)
 11 rtCtl;        Fld  7: Round-Trip Ctrl Info 8N,bit  (Byte    11)
 12 flags[2];     Fld  8: BASE I Flags        16N,bit  (Byte 12-13)
 14 status[3];    Fld  9: Message Status Flags 24bits  (Byte 14-16)
 17 batchNbr;     Fld 10: Batch Number        1B       (Byte    17)
 18 reserved[3];  Fld 11: Reserved            3B       (Byte 18-20)
 21 userInfo;     Fld 12: User Info           1B       (Byte    21)
 The following fields are only presend in a reject message
 22 bitmap;       Fld 13: Bitmap              2B       (Byte 22-23)
 24 rejectdata;   Fld 14: Reject Data Group   2B       (Byte 24-25)
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Fixed length of a BASE-1 header in bytes.

    Fields inherited from class BaseHeader

    header
    Modifier and Type
    Field
    Description
    protected byte[]
    Raw header bytes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a BASE1Header with source and destination both set to "000000".
    BASE1Header(byte[] header)
    Creates a BASE1Header from a raw byte array.
    BASE1Header(String source, String destination)
    Creates a BASE1Header with the given source and destination and default format (2).
    BASE1Header(String source, String destination, int format)
    Creates a BASE1Header with explicit format.
  • Method Summary

    Modifier and Type
    Method
    Description
    Formats the header fields as a human-readable diagnostic string.
    Returns the destination address in this ISOHeader.
    int
    Returns the message format code.
    int
    Returns the header length field value.
    Gets the BASE 1 Reject Code.
    Returns the source address in this ISOHeader.
    boolean
    Returns true if this message is a BASE-1 reject.
    void
    Sets the batch number.
    void
    Sets the destination address in this ISOHeader.
    void
    setFlags(int i)
    Sets the flags field.
    void
    setFormat(int format)
    Sets the message format code.
    void
    setHFormat(int hformat)
    Sets the header format byte.
    void
    setLen(int len)
    Sets the message length field in the header.
    void
    setRtCtl(int i)
    Sets the routing control byte.
    void
    Sets the source address in this ISOHeader.
    void
    setStatus(int i)
    Sets the status field.
    void
    Swaps the source and destination addresses in this ISOHeader (if they exist).

    Methods inherited from class BaseHeader

    clone, dump, getLength, isAsciiEncoding, pack, setAsciiEncoding, unpack
    Modifier and Type
    Method
    Description
    Returns a clone of this ISOHeader.
    void
    dump(PrintStream p, String indent)
    Dumps a human-readable representation of this object to the print stream.
    int
    Returns the number of bytes in this ISOHeader when packed.
    boolean
    Returns true if ASCII encoding is used for source/destination fields.
    byte[]
    Packs this header into a byte array.
    void
    setAsciiEncoding(boolean asciiEncoding)
    Sets the encoding for source/destination fields.
    int
    unpack(byte[] header)
    Unpacks the header from a raw byte array.

    Methods inherited from class Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface Loggeable

    dump
    Modifier and Type
    Method
    Description
    default void
    Dumps a representation of this object using the specified renderer type.
  • Field Details

  • Constructor Details

    • BASE1Header

      public BASE1Header()
      Creates a BASE1Header with source and destination both set to "000000".
    • BASE1Header

      public BASE1Header(String source, String destination)
      Creates a BASE1Header with the given source and destination and default format (2).
      Parameters:
      source - 6-digit source ID
      destination - 6-digit destination ID
    • BASE1Header

      public BASE1Header(String source, String destination, int format)
      Creates a BASE1Header with explicit format.
      Parameters:
      source - 6-digit source ID
      destination - 6-digit destination ID
      format - header format code
    • BASE1Header

      public BASE1Header(byte[] header)
      Creates a BASE1Header from a raw byte array.
      Parameters:
      header - raw header bytes
  • Method Details

    • getHLen

      public int getHLen()
      Returns the header length field value.
      Returns:
      header length
    • setHFormat

      public void setHFormat(int hformat)
      Sets the header format byte.
      Parameters:
      hformat - header format value
    • getFormat

      public int getFormat()
      Returns the message format code.
      Returns:
      message format code
    • setRtCtl

      public void setRtCtl(int i)
      Sets the routing control byte.
      Parameters:
      i - routing control value
    • setFlags

      public void setFlags(int i)
      Sets the flags field.
      Parameters:
      i - flags value
    • setStatus

      public void setStatus(int i)
      Sets the status field.
      Parameters:
      i - status value
    • setBatchNumber

      public void setBatchNumber(int i)
      Sets the batch number.
      Parameters:
      i - batch number
    • setFormat

      public void setFormat(int format)
      Sets the message format code.
      Parameters:
      format - the message format code
    • setLen

      public void setLen(int len)
      Sets the message length field in the header.
      Parameters:
      len - the payload length (header length will be added automatically)
    • setDestination

      public void setDestination(String dest)
      Description copied from interface: ISOHeader
      Sets the destination address in this ISOHeader.
      Specified by:
      setDestination in interface ISOHeader
      Overrides:
      setDestination in class BaseHeader
      Parameters:
      dest - the destination address
    • setSource

      public void setSource(String src)
      Description copied from interface: ISOHeader
      Sets the source address in this ISOHeader.
      Specified by:
      setSource in interface ISOHeader
      Overrides:
      setSource in class BaseHeader
      Parameters:
      src - the source address
    • getSource

      public String getSource()
      Description copied from interface: ISOHeader
      Returns the source address in this ISOHeader.
      Specified by:
      getSource in interface ISOHeader
      Overrides:
      getSource in class BaseHeader
      Returns:
      the source address, or null if not set
    • getDestination

      Description copied from interface: ISOHeader
      Returns the destination address in this ISOHeader.
      Specified by:
      getDestination in interface ISOHeader
      Overrides:
      getDestination in class BaseHeader
      Returns:
      the destination address, or null if not set
    • swapDirection

      public void swapDirection()
      Description copied from interface: ISOHeader
      Swaps the source and destination addresses in this ISOHeader (if they exist).
      Specified by:
      swapDirection in interface ISOHeader
      Overrides:
      swapDirection in class BaseHeader
    • isRejected

      public boolean isRejected()
      Returns true if this message is a BASE-1 reject.
      Returns:
      true if the message is rejected
    • getRejectCode

      Gets the BASE 1 Reject Code.
      Returns:
      If the message is a reject return the Reject Code Otherwise return ""
    • formatHeader

      public String formatHeader()
      Formats the header fields as a human-readable diagnostic string.
      Returns:
      formatted header dump