FieldParseInfo is now an abstract class, with a concrete subclass for each IsoType. This greatly improves the parsing speed.
git-svn-id: https://j8583.svn.sourceforge.net/svnroot/j8583/j8583@66 db60a039-f72e-0410-b1d2-baa000846441
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.solab.iso8583.parse;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
import com.solab.iso8583.CustomField;
|
||||
import com.solab.iso8583.IsoType;
|
||||
import com.solab.iso8583.IsoValue;
|
||||
|
||||
/** This is the class used to parse ALPHA fields.
|
||||
*
|
||||
* @author Enrique Zamudio
|
||||
*/
|
||||
public class AlphaParseInfo extends AlphaNumericFieldParseInfo {
|
||||
|
||||
public AlphaParseInfo(int len) {
|
||||
super(IsoType.ALPHA, len);
|
||||
}
|
||||
|
||||
public <T extends Object> IsoValue<?> parseBinary(byte[] buf, int pos, CustomField<T> custom) throws ParseException {
|
||||
if (custom == null) {
|
||||
return new IsoValue<String>(type, new String(buf, pos, length), length, null);
|
||||
} else {
|
||||
IsoValue<T> v = new IsoValue<T>(type, custom.decodeField(new String(buf, pos, length)), length, custom);
|
||||
if (v.getValue() == null) {
|
||||
return new IsoValue<String>(type, new String(buf, pos, length), length, null);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user