com.solab.iso8583.parse
Class FieldParseInfo

java.lang.Object
  extended by com.solab.iso8583.parse.FieldParseInfo
Direct Known Subclasses:
AlphaNumericFieldParseInfo, AmountParseInfo, BinaryParseInfo, Date10ParseInfo, Date4ParseInfo, DateExpParseInfo, LlbinParseInfo, LllbinParseInfo, LllvarParseInfo, LlvarParseInfo, TimeParseInfo

public abstract class FieldParseInfo
extends Object

This class is used to parse a field from a message buffer. There are concrete subclasses for each IsoType.

Author:
Enrique Zamudio

Field Summary
protected  int length
           
protected  IsoType type
           
 
Constructor Summary
FieldParseInfo(IsoType t, int len)
          Creates a new instance that parses a value of the specified type, with the specified length.
 
Method Summary
 String getCharacterEncoding()
           
static FieldParseInfo getInstance(IsoType t, int len, String encoding)
          Returns a new FieldParseInfo instance that can parse the specified type.
 int getLength()
          Returns the specified length for the data to be parsed.
 IsoType getType()
          Returns the data type for the data to be parsed.
abstract
<T> IsoValue<?>
parse(byte[] buf, int pos, CustomField<T> custom)
          Parses the character data from the buffer and returns the IsoValue with the correct data type in it.
abstract
<T> IsoValue<?>
parseBinary(byte[] buf, int pos, CustomField<T> custom)
          Parses binary data from the buffer, creating and returning an IsoValue of the configured type and length.
 void setCharacterEncoding(String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected IsoType type

length

protected int length
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

setCharacterEncoding

public void setCharacterEncoding(String value)

getCharacterEncoding

public 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.


parse

public abstract <T> IsoValue<?> parse(byte[] buf,
                                      int pos,
                                      CustomField<T> custom)
                           throws ParseException,
                                  UnsupportedEncodingException
Parses the character data from the buffer and returns the IsoValue with the correct data type in it.

Throws:
ParseException
UnsupportedEncodingException

parseBinary

public abstract <T> IsoValue<?> parseBinary(byte[] buf,
                                            int pos,
                                            CustomField<T> custom)
                                 throws ParseException,
                                        UnsupportedEncodingException
Parses binary data from the buffer, creating and returning an IsoValue of the configured type and length.

Throws:
ParseException
UnsupportedEncodingException

getInstance

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



Copyright © 2011 Enrique Zamudio. All Rights Reserved.