Class FieldParseInfo

    • Field Detail

      • length

        protected final int length
      • forceStringDecoding

        protected boolean forceStringDecoding
      • forceHexadecimalLength

        protected boolean forceHexadecimalLength
    • Constructor Detail

      • FieldParseInfo

        public FieldParseInfo​(IsoType t,
                              int len)
        Creates a new instance that parses a value of the specified type, with the specified length. The length is only useful for ALPHA and NUMERIC types.
        Parameters:
        t - The ISO type to be parsed.
        len - The length of the data to be read (useful only for ALPHA and NUMERIC types).
    • Method Detail

      • setForceStringDecoding

        public void setForceStringDecoding​(boolean flag)
        Specified whether length headers for variable-length fields in text mode should be decoded using proper string conversion with the character encoding. Default is false, which means use the old behavior of decoding as ASCII.
      • setForceHexadecimalLength

        public void setForceHexadecimalLength​(boolean flag)
        Specifies whether length headers for variable-length fields in binary mode should be decoded as a hexadecimal values. Default is false, which means decoding the length as BCD.
      • setCharacterEncoding

        public void setCharacterEncoding​(java.lang.String value)
      • getCharacterEncoding

        public java.lang.String getCharacterEncoding()
      • getLength

        public int getLength()
        Returns the specified length for the data to be parsed.
      • getType

        public IsoType getType()
        Returns the data type for the data to be parsed.
      • setDecoder

        public void setDecoder​(CustomField<?> value)
      • parse

        public abstract <T> IsoValue<?> parse​(int field,
                                              byte[] buf,
                                              int pos,
                                              CustomField<T> custom)
                                       throws java.text.ParseException,
                                              java.io.UnsupportedEncodingException
        Parses the character data from the buffer and returns the IsoValue with the correct data type in it.
        Parameters:
        field - The field index, useful for error reporting.
        buf - The full ISO message buffer.
        pos - The starting position for the field data.
        custom - A CustomField to decode the field.
        Throws:
        java.text.ParseException
        java.io.UnsupportedEncodingException
      • parseBinary

        public abstract <T> IsoValue<?> parseBinary​(int field,
                                                    byte[] buf,
                                                    int pos,
                                                    CustomField<T> custom)
                                             throws java.text.ParseException,
                                                    java.io.UnsupportedEncodingException
        Parses binary data from the buffer, creating and returning an IsoValue of the configured type and length.
        Parameters:
        field - The field index, useful for error reporting.
        buf - The full ISO message buffer.
        pos - The starting position for the field data.
        custom - A CustomField to decode the field.
        Throws:
        java.text.ParseException
        java.io.UnsupportedEncodingException
      • getInstance

        public static FieldParseInfo getInstance​(IsoType t,
                                                 int len,
                                                 java.lang.String encoding)
        Returns a new FieldParseInfo instance that can parse the specified type.
      • decodeLength

        protected int decodeLength​(byte[] buf,
                                   int pos,
                                   int digits)
                            throws java.io.UnsupportedEncodingException
        Throws:
        java.io.UnsupportedEncodingException