AZS

com.a2zss.ISO8583
Class ISO8583II

java.lang.Object
  extended by com.a2zss.ISO8583.ISO8583II
All Implemented Interfaces:
ISOConstants

public class ISO8583II
extends java.lang.Object
implements ISOConstants

This class can be used as parser and formatter


Field Summary
 
Fields inherited from interface com.a2zss.ISO8583.ISOConstants
AUTHORISATION, AUTHORISATION_REPEAT, AUTHORISATION_RESPONSE, CASH_ADVANCE, CLEARING_REQUEST, CLEARING_REQUEST_RESPONSE, ENC_CODED, ENC_LLLLPLAIN, ENC_PACKED, ENC_PLAIN, mandatoryBits, MSG_MAX_LENGTH, MTID, MTISTRING, NETWORK_REQUEST, NETWORK_RESPONSE, optionalBits, ORDINAL_PURCHASE, PROCS, PROCSTR, REVAERSAL_RESPONSE, REVERSAL, REVERSAL_REPEAT, SMS_AUTHORISATION, SMS_AUTHORISATION_REPEAT, SMS_AUTHORISATION_RESPONSE, UNATTENDED_PURCHASE, V1987, V1993, V2003
 
Constructor Summary
ISO8583II()
          Class constructor
ISO8583II(Config con)
          Class constructor
 
Method Summary
 byte[] createBinLenPackedValue(ISOField f)
          Method createBinLenPackedValue
 byte[] createPackedValue(ISOField f)
           
 byte[] formatEncoded(Message msg)
          Formats message in packed and encoded format
 byte[] formatLLLLPlain(Message msg)
          Formats the message in plain format with 4 byte length
Note: supports fields FH_IDENT, FH_DCP, FF_FOT if they are configured
 byte[] formatLLPlain(Message msg)
          Formats the message in plain format with two byte length
Note: supports fields FH_IDENT, FH_DCP, FF_FOT if they are configured
 byte[] formatPacked(Message msg)
          Method to format message in packed format
 byte[] formatPlain(Message msg)
          Formats the message in plain format
Note: supports fields FH_IDENT, FH_DCP, FF_FOT if they are configured
 Config getConfig()
           
 int getDebuglevel()
           
 byte[] getEncoded(byte[] in)
          gets the encoded data block from syntax 2
 byte[] getEncoded(java.io.InputStream is)
          gets the encoded data block from syntax 2 encoded stream
 int getEncodingType(byte[] msg)
          checks the ISO message encoding type from bye[] array
 int getEncodingType(java.io.PushbackInputStream is)
          checks the ISO message encoding type from stream
 java.io.PrintStream getOutput()
           
 Message parseLLLLPlain(java.io.InputStream is)
          parses the LLLLplain format from inputstream Note: supports fields FH_IDENT, FH_DCP, FF_FOTif they are configured
 Message parseLLPlain(java.io.InputStream is)
          parses the LLplain format from inputstream (where LL is two byte (packed/binary length) Note: supports fields FH_IDENT, FH_DCP, FF_FOTif they are configured
 Message parsePacked(byte[] in)
          parses the packed ISO8583 format from buffer
 Message parsePacked(java.io.InputStream is)
          parses the packed ISO8583 format from stream
 Message parsePlain(byte[] buf)
          parses the plain format from byte buffer
Note: supports fields FH_IDENT, FH_DCP, FF_FOT if they are configured
 Message parsePlain(java.io.InputStream is)
          parses the plain format from inputstream
Note: supports fields FH_IDENT, FH_DCP, FF_FOT if they are configured
 ISOField parsePlainField(java.io.DataInputStream dis, int i, int ver)
          Parses current field from underlying stream from its currecnt position (used internally)
 Message parseStream(java.io.InputStream is)
          Parses and detects near any ISO8583 format from InputStream (without custom headers used) recognizes automatically messages without headers and with length in plain or encoded fromat
Messages with header fields before MTI cannot be parsed with this
 void setConfig(Config con)
           
 void setDebuglevel(int debuglevel)
           
 void setOutput(java.io.PrintStream os)
          Set the debug output stream
 void validateFields(Message flds)
          validates if the fields Message contains reflect the type and format required or if there are fields not compatible with required length and type then throws an ISOException
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ISO8583II

public ISO8583II()
Class constructor


ISO8583II

public ISO8583II(Config con)
Class constructor

Parameters:
con - - hte configuration to use
Method Detail

setConfig

public void setConfig(Config con)
Parameters:
con -

getConfig

public Config getConfig()
Returns:
the current config

setOutput

public void setOutput(java.io.PrintStream os)
Set the debug output stream

Parameters:
os -

getOutput

public java.io.PrintStream getOutput()
Returns:
the current debug stream

getDebuglevel

public int getDebuglevel()
Returns:
Returns the debuglevel.

setDebuglevel

public void setDebuglevel(int debuglevel)
Parameters:
debuglevel - The debuglevel to set. (0..5)

getEncodingType

public final int getEncodingType(java.io.PushbackInputStream is)
                          throws java.lang.Exception
checks the ISO message encoding type from stream

Parameters:
is - the message data stream
Returns:
the encoding constans ENC_CODED | ENC_LLLLPLAIN | ENC_PLAIN
Throws:
java.lang.Exception - if error

getEncodingType

public final int getEncodingType(byte[] msg)
                          throws java.lang.Exception
checks the ISO message encoding type from bye[] array

Parameters:
msg - the message data
Returns:
the encoding constans ENC_CODED | ENC_LLLLPLAIN | ENC_PLAIN
Throws:
java.lang.Exception

getEncoded

public final byte[] getEncoded(byte[] in)
                        throws java.lang.Exception
gets the encoded data block from syntax 2

Parameters:
in -
Throws:
java.lang.Exception

getEncoded

public final byte[] getEncoded(java.io.InputStream is)
                        throws java.lang.Exception
gets the encoded data block from syntax 2 encoded stream

Parameters:
is -
Returns:
the encoded data buffer
Throws:
java.lang.Exception

formatPacked

public final byte[] formatPacked(Message msg)
                          throws java.lang.Exception
Method to format message in packed format

Parameters:
msg - the message object with fields to format
Returns:
a buffer with ISO message in packed format
Throws:
java.lang.Exception

formatEncoded

public final byte[] formatEncoded(Message msg)
                           throws java.lang.Exception
Formats message in packed and encoded format

Parameters:
msg - the message object with fields to format
Returns:
a buffer with ISO message encoded and fomratted: S LN T DATA CCC E
Throws:
java.lang.Exception

formatPlain

public final byte[] formatPlain(Message msg)
                         throws java.lang.Exception
Formats the message in plain format
Note: supports fields FH_IDENT, FH_DCP, FF_FOT if they are configured

Parameters:
msg - the message object to be formatted
Returns:
a buffer with ISO message in plain format
Throws:
java.lang.Exception

formatLLPlain

public final byte[] formatLLPlain(Message msg)
                           throws java.lang.Exception
Formats the message in plain format with two byte length
Note: supports fields FH_IDENT, FH_DCP, FF_FOT if they are configured

Parameters:
msg - the message object to be formatted
Returns:
a buffer with ISO message plain format with message length LL (two bytes packed)
Throws:
java.lang.Exception

formatLLLLPlain

public final byte[] formatLLLLPlain(Message msg)
                             throws java.lang.Exception
Formats the message in plain format with 4 byte length
Note: supports fields FH_IDENT, FH_DCP, FF_FOT if they are configured

Parameters:
msg - the message object to be formatted
Returns:
a buffer with ISO message plain format with message length LLLL (4 bytes)
Throws:
java.lang.Exception

parseStream

public final Message parseStream(java.io.InputStream is)
                          throws java.lang.Exception
Parses and detects near any ISO8583 format from InputStream (without custom headers used) recognizes automatically messages without headers and with length in plain or encoded fromat
Messages with header fields before MTI cannot be parsed with this

Parameters:
is - the inputsream to parse
Returns:
a Message containing the parsed ISO fields
Throws:
java.lang.Exception

parsePacked

public final Message parsePacked(byte[] in)
                          throws java.lang.Exception
parses the packed ISO8583 format from buffer

Parameters:
in - bytes to parse
Returns:
the message
Throws:
java.lang.Exception

parsePacked

public final Message parsePacked(java.io.InputStream is)
                          throws java.lang.Exception
parses the packed ISO8583 format from stream

Parameters:
is -
Returns:
the message
Throws:
java.lang.Exception

parseLLPlain

public final Message parseLLPlain(java.io.InputStream is)
                           throws java.lang.Exception
parses the LLplain format from inputstream (where LL is two byte (packed/binary length) Note: supports fields FH_IDENT, FH_DCP, FF_FOTif they are configured

Parameters:
is - the inputstream
Returns:
the message
Throws:
java.lang.Exception

parseLLLLPlain

public final Message parseLLLLPlain(java.io.InputStream is)
                             throws java.lang.Exception
parses the LLLLplain format from inputstream Note: supports fields FH_IDENT, FH_DCP, FF_FOTif they are configured

Parameters:
is - inputstream
Returns:
the message
Throws:
java.lang.Exception

parsePlain

public final Message parsePlain(byte[] buf)
                         throws java.lang.Exception
parses the plain format from byte buffer
Note: supports fields FH_IDENT, FH_DCP, FF_FOT if they are configured

Parameters:
buf - - the byte buffer to parse
Returns:
the message
Throws:
java.lang.Exception

parsePlain

public final Message parsePlain(java.io.InputStream is)
                         throws java.lang.Exception
parses the plain format from inputstream
Note: supports fields FH_IDENT, FH_DCP, FF_FOT if they are configured

Parameters:
is - - the inputstream
Returns:
the message
Throws:
java.lang.Exception

validateFields

public final void validateFields(Message flds)
                          throws java.lang.Exception
validates if the fields Message contains reflect the type and format required or if there are fields not compatible with required length and type then throws an ISOException

Parameters:
flds - - the message to validate
Throws:
java.lang.Exception - if not all fields valid

parsePlainField

public final ISOField parsePlainField(java.io.DataInputStream dis,
                                      int i,
                                      int ver)
                               throws java.lang.Exception
Parses current field from underlying stream from its currecnt position (used internally)

Parameters:
dis -
i - - field number
ver - - the ISO8583 version (0, 1)
Returns:
- the field object
Throws:
java.lang.Exception

createPackedValue

public final byte[] createPackedValue(ISOField f)
Returns:
the 4bit bcd encoded/packed data in case of numeric fields

createBinLenPackedValue

public final byte[] createBinLenPackedValue(ISOField f)
Method createBinLenPackedValue

Returns:
the binary encoded lengths and 4bit bcd encoded/packed numeric data in case of numeric fields

AZS

Copyright © 2002-2010 AZS Services Ltd. All Rights Reserved.