protected int decodeMandatoryVariableParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
            throws ParameterException {
        // FIXME: possibly this should also be per msg, since if msg lacks
        // proper parameter, decoding wotn pick this up and will throw
        // some bad output, which wont give a clue about reason...
        int readCount = 0;
        // int optionalOffset = 0;

        if (b.length - index > 0) {

            byte extPIndex = -1;
            try {
                int count = getNumberOfMandatoryVariableLengthParameters();
                readCount = count;
                for (int parameterIndex = 0; parameterIndex < count; parameterIndex++) {
                    int lengthPointerIndex = index + parameterIndex;
                    int parameterLengthIndex = b[lengthPointerIndex] + lengthPointerIndex;

                    int parameterLength = b[parameterLengthIndex];
                    byte[] parameterBody = new byte[parameterLength];
                    System.arraycopy(b, parameterLengthIndex + 1, parameterBody, 0, parameterLength);
                    decodeMandatoryVariableBody(parameterFactory, parameterBody, parameterIndex);

                }

                // optionalOffset = b[index + readCount];
            } catch (ArrayIndexOutOfBoundsException aioobe) {
                throw new ParameterException(
                        "Failed to read parameter, to few octets in buffer, parameter index: " + extPIndex, aioobe);
            } catch (IllegalArgumentException e) {
                throw new ParameterException("Failed to parse, paramet index: " + extPIndex, e);
            }
        } else {
            throw new ParameterException(
                    "To few bytes to decode mandatory variable part. There should be atleast on byte to indicate optional part.");
        }

        // return readCount + optionalOffset;
        return readCount;
    }
protected int decodeMandatoryVariableParameters ( ISUPParameterFactory parameterFactory , byte [ ] b , int index ) throws ParameterException { int readCount = 0 ; if ( b . length - index > 0 ) { byte extPIndex = - 1 ; try { int count = getNumberOfMandatoryVariableLengthParameters ( ) ; readCount = count ; for ( int parameterIndex = 0 ; parameterIndex < count ; parameterIndex ++ ) { int lengthPointerIndex = index + parameterIndex ; int parameterLengthIndex = b [ lengthPointerIndex ] + lengthPointerIndex ; int parameterLength = b [ parameterLengthIndex ] ; byte [ ] parameterBody = new byte [ parameterLength ] ; System . arraycopy ( b , parameterLengthIndex + 1 , parameterBody , 0 , parameterLength ) ; decodeMandatoryVariableBody ( parameterFactory , parameterBody , parameterIndex ) ; } } catch ( ArrayIndexOutOfBoundsException aioobe ) { throw new ParameterException ( "Failed to read parameter, to few octets in buffer, parameter index: " + extPIndex , aioobe ) ; } catch ( IllegalArgumentException e ) { throw new ParameterException ( "Failed to parse, paramet index: " + extPIndex , e ) ; } } else { throw new ParameterException ( "To few bytes to decode mandatory variable part. There should be atleast on byte to indicate optional part." ) ; } return readCount ; }
decodes ptrs and returns offset from passed index value to first optional parameter parameter

@param b
@param index
@return
@throws ParameterException