Class BASE1Header
java.lang.Object
org.jpos.iso.header.BaseHeader
org.jpos.iso.header.BASE1Header
- All Implemented Interfaces:
Serializable, Cloneable, ISOHeader, Loggeable
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
FieldsModifier and TypeFieldDescriptionstatic final intFixed length of a BASE-1 header in bytes.Fields inherited from class BaseHeader
header -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionFormats the header fields as a human-readable diagnostic string.Returns the destination address in this ISOHeader.intReturns the message format code.intgetHLen()Returns the header length field value.Gets the BASE 1 Reject Code.Returns the source address in this ISOHeader.booleanReturns true if this message is a BASE-1 reject.voidsetBatchNumber(int i) Sets the batch number.voidsetDestination(String dest) Sets the destination address in this ISOHeader.voidsetFlags(int i) Sets the flags field.voidsetFormat(int format) Sets the message format code.voidsetHFormat(int hformat) Sets the header format byte.voidsetLen(int len) Sets the message length field in the header.voidsetRtCtl(int i) Sets the routing control byte.voidSets the source address in this ISOHeader.voidsetStatus(int i) Sets the status field.voidSwaps the source and destination addresses in this ISOHeader (if they exist).Methods inherited from class BaseHeader
clone, dump, getLength, isAsciiEncoding, pack, setAsciiEncoding, unpackModifier and TypeMethodDescriptionclone()Returns a clone of this ISOHeader.voiddump(PrintStream p, String indent) Dumps a human-readable representation of this object to the print stream.intReturns the number of bytes in this ISOHeader when packed.booleanReturns true if ASCII encoding is used for source/destination fields.byte[]pack()Packs this header into a byte array.voidsetAsciiEncoding(boolean asciiEncoding) Sets the encoding for source/destination fields.intunpack(byte[] header) Unpacks the header from a raw byte array.Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Loggeable
dumpModifier and TypeMethodDescriptiondefault voiddump(PrintStream p, String indent, LogRenderer.Type type) Dumps a representation of this object using the specified renderer type.
-
Field Details
-
LENGTH
-
-
Constructor Details
-
BASE1Header
public BASE1Header()Creates a BASE1Header with source and destination both set to"000000". -
BASE1Header
Creates a BASE1Header with the given source and destination and default format (2).- Parameters:
source- 6-digit source IDdestination- 6-digit destination ID
-
BASE1Header
Creates a BASE1Header with explicit format.- Parameters:
source- 6-digit source IDdestination- 6-digit destination IDformat- header format code
-
BASE1Header
Creates a BASE1Header from a raw byte array.- Parameters:
header- raw header bytes
-
-
Method Details
-
getHLen
-
setHFormat
Sets the header format byte.- Parameters:
hformat- header format value
-
getFormat
-
setRtCtl
-
setFlags
-
setStatus
-
setBatchNumber
-
setFormat
Sets the message format code.- Parameters:
format- the message format code
-
setLen
Sets the message length field in the header.- Parameters:
len- the payload length (header length will be added automatically)
-
setDestination
Description copied from interface:ISOHeaderSets the destination address in this ISOHeader.- Specified by:
setDestinationin interfaceISOHeader- Overrides:
setDestinationin classBaseHeader- Parameters:
dest- the destination address
-
setSource
-
getSource
-
getDestination
Description copied from interface:ISOHeaderReturns the destination address in this ISOHeader.- Specified by:
getDestinationin interfaceISOHeader- Overrides:
getDestinationin classBaseHeader- Returns:
- the destination address, or null if not set
-
swapDirection
Description copied from interface:ISOHeaderSwaps the source and destination addresses in this ISOHeader (if they exist).- Specified by:
swapDirectionin interfaceISOHeader- Overrides:
swapDirectionin classBaseHeader
-
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
Formats the header fields as a human-readable diagnostic string.- Returns:
- formatted header dump
-