Source Code Cross Referenced for ByteArrayParser.java in  » J2EE » Sofia » com » salmonllc » parser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Sofia » com.salmonllc.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        //** Copyright Statement ***************************************************
0002:        //The Salmon Open Framework for Internet Applications (SOFIA)
0003:        // Copyright (C) 1999 - 2002, Salmon LLC
0004:        //
0005:        // This program is free software; you can redistribute it and/or
0006:        // modify it under the terms of the GNU General Public License version 2
0007:        // as published by the Free Software Foundation;
0008:        //
0009:        // This program is distributed in the hope that it will be useful,
0010:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
0011:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012:        // GNU General Public License for more details.
0013:        //
0014:        // You should have received a copy of the GNU General Public License
0015:        // along with this program; if not, write to the Free Software
0016:        // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
0017:        //
0018:        // For more information please visit http://www.salmonllc.com
0019:        //** End Copyright Statement ***************************************************
0020:
0021:        package com.salmonllc.parser;
0022:
0023:        import java.text.DecimalFormat;
0024:        import java.text.SimpleDateFormat;
0025:        import java.util.Vector;
0026:
0027:        import com.salmonllc.util.MessageLog;
0028:
0029:        /**
0030:         * This object is used to describe a byte array representing column data in fixed locations. <BR>
0031:         * The Byte Array is a representation of a cobol copy book.
0032:         */
0033:
0034:        public class ByteArrayParser {
0035:            /*
0036:                <P><PRE>
0037:                The Following Constants of ByteArrayParser are to be used
0038:            	by a developer whose specifying Column Definitions for
0039:            	an instance of ByteArrayParser. These constants represent the
0040:            	possibilities for the type parameter in 
0041:            	addColumnDefinition(int,String,int,int,int,boolean).
0042:            	
0043:            	TYPE_INT=1
0044:            	TYPE_STRING=2;
0045:            	TYPE_FLOAT=3;
0046:            	TYPE_FLOAT2=4;
0047:            	TYPE_DATE_CCYYMMDD=5;
0048:            	TYPE_DATE_MMYY=6;
0049:            	TYPE_DATE_YYMM=7;
0050:            	</PRE></P>
0051:             */
0052:            public final static int TYPE_INT = 1;
0053:            public final static int TYPE_STRING = 2;
0054:            public final static int TYPE_FLOAT = 3;
0055:            public final static int TYPE_DOUBLE = 4;
0056:            public final static int TYPE_DATE_CCYYMMDD = 5;
0057:            public final static int TYPE_DATE_MMYY = 6;
0058:            public final static int TYPE_DATE_YYMM = 7;
0059:            public final static int TYPE_DATE_MMDDCCYY = 8;
0060:            public final static int TYPE_TIME_HHMMSS = 9;
0061:            public final static int TYPE_CHAR = 10;
0062:            public final static int TYPE_CUSTOM = 0;
0063:            /**Used for Date Formating.*/
0064:            private final static char cDecimalSeparator = '.';
0065:            /**Used for Date Formating.*/
0066:            private final static char cDateSeparator = '/';
0067:            /**Used for Number Formating.*/
0068:            private final static char cNegativeSign = '-';
0069:            /**Array to hold column lengths.*/
0070:            private int[] DATALENGTHS;
0071:            /**Array to hold start indexes of the columns. */
0072:            private int[] DATASTARTINDEXES;
0073:            /**Array to hold type definitons of the columns. */
0074:            private int[] DATATYPES;
0075:            /**Array to indicate if columns are signed.*/
0076:            private boolean[] DATASIGNED;
0077:            /**Array to hold names of columns.*/
0078:            private String[] DATACOLUMNNAMES;
0079:            /**Array to hold instances of custom type objects.*/
0080:            private CustomType[] DATACUSTOMTYPES;
0081:            /**Array to hold precision values for float datatype.*/
0082:            private int[] DATAPRECISIONS;
0083:            /**Array to hold redefined values to indicate if column is a redefined column.*/
0084:            private boolean[] DATAREDEFINED;
0085:            /**Array to hold message (Complete Row or Multiple Rows);*/
0086:            private byte[] baOutputMessage;
0087:            /**Offset to start of next row in message.*/
0088:            private int OFFSET = 0;
0089:            private int CURRENTROWOFFSET = 0;
0090:            /**Length of a row in Message.*/
0091:            private int ROWLENGTH = 0;
0092:            /**Indicates if message contains multiple rows.*/
0093:            private boolean MULTIROW = false;
0094:            /**Indicates if Row Length was Calculated.*/
0095:            private boolean CALCROWLENGTH = true;
0096:            /**Calculated Row Length based on Column Definitions.*/
0097:            private int ACTUALROWLENGTH = 0;
0098:            /**Indicates the current start index of a new column.*/
0099:            private int STARTINDEX = 0;
0100:            /**Indicates the current column number of a new column.*/
0101:            private int STARTFIELD = 0;
0102:            /**Vector of objects after message is parsed.*/
0103:            private Vector _data = null;
0104:
0105:            /**
0106:              Allocates a new <CODE>ByteArrayParser</CODE> object from a byte[] and a specified number of columns.
0107:            
0108:              <P><PRE>
0109:              Constructor: ByteArrayParser(byte[] baOutputMessage,int iNumColumns)
0110:              Visibility: Public
0111:              </PRE></P>
0112:              @param baOutputMessage 		This is the message containing a row or multiple rows.
0113:              @param iNumColumns			Specifies the number of Columns in a row.									
0114:             */
0115:            public ByteArrayParser(byte[] baOutputMessage, int iNumColumns) {
0116:                DATALENGTHS = new int[iNumColumns];
0117:                DATASTARTINDEXES = new int[iNumColumns];
0118:                DATATYPES = new int[iNumColumns];
0119:                DATASIGNED = new boolean[iNumColumns];
0120:                DATACOLUMNNAMES = new String[iNumColumns];
0121:                DATACUSTOMTYPES = new CustomType[iNumColumns];
0122:                DATAPRECISIONS = new int[iNumColumns];
0123:                DATAREDEFINED = new boolean[iNumColumns];
0124:                this .baOutputMessage = baOutputMessage;
0125:                _data = new Vector(iNumColumns);
0126:                for (int i = 0; i < iNumColumns; i++)
0127:                    _data.addElement(null);
0128:
0129:                //System.out.println("DATALENGTHS.length is "+DATALENGTHS.length);
0130:            }
0131:
0132:            /**
0133:              Allocates a new <CODE>ByteArrayParser</CODE> object from a byte[] and arrays of the attributes describing the columns.
0134:
0135:              <P><PRE>
0136:              Constructor: ByteArrayParser(byte[] baOutputMessage,int[] datalengths,int[] datastartindexes,int[] datatypes,boolean[] datasigned,String[] datacolumnnames,CustomType[] datacustomtypes,int[] dataprecisions)
0137:              Visibility: Public
0138:              </PRE></P>
0139:              @param baOutputMessage 		This is the message containing a row or multiple rows.
0140:              @param datalengths			This is an array of the lengths for the columns.
0141:              @param datastartindexes		This is an array of the start indexes for the columns.
0142:              @param datatypes			    This is an array of the types for the columns.
0143:              @param datasigned			    This is an array of the signed attribute for the columns.
0144:              @param datacolumnnames		This is an array of the column names for the columns.
0145:              @param datacustomtypes		This is an array of the custom type representations for the columns.
0146:              @param dataprecisions			This is an array of the precisions for the columns.
0147:             */
0148:            public ByteArrayParser(byte[] baOutputMessage, int[] datalengths,
0149:                    int[] datastartindexes, int[] datatypes,
0150:                    boolean[] datasigned, String[] datacolumnnames,
0151:                    CustomType[] datacustomtypes, int[] dataprecisions) {
0152:                this (baOutputMessage, datalengths, datastartindexes, datatypes,
0153:                        datasigned, datacolumnnames, datacustomtypes,
0154:                        dataprecisions, null);
0155:            }
0156:
0157:            /**
0158:              Allocates a new <CODE>ByteArrayParser</CODE> object from a byte[] and arrays of the attributes describing the columns.
0159:
0160:              <P><PRE>
0161:              Constructor: ByteArrayParser(byte[] baOutputMessage,int[] datalengths,int[] datastartindexes,int[] datatypes,boolean[] datasigned,String[] datacolumnnames,CustomType[] datacustomtypes,int[] dataprecisions)
0162:              Visibility: Public
0163:              </PRE></P>
0164:              @param baOutputMessage 		This is the message containing a row or multiple rows.
0165:              @param datalengths			This is an array of the lengths for the columns.
0166:              @param datastartindexes		This is an array of the start indexes for the columns.
0167:              @param datatypes			    This is an array of the types for the columns.
0168:              @param datasigned			    This is an array of the signed attribute for the columns.
0169:              @param datacolumnnames		This is an array of the column names for the columns.
0170:              @param datacustomtypes		This is an array of the custom type representations for the columns.
0171:              @param dataprecisions			This is an array of the precisions for the columns.
0172:              @param dataredefined			This is an array of the redefined attribute for the columns.
0173:             */
0174:            public ByteArrayParser(byte[] baOutputMessage, int[] datalengths,
0175:                    int[] datastartindexes, int[] datatypes,
0176:                    boolean[] datasigned, String[] datacolumnnames,
0177:                    CustomType[] datacustomtypes, int[] dataprecisions,
0178:                    boolean[] dataredefined) {
0179:                DATALENGTHS = datalengths;
0180:                DATASTARTINDEXES = datastartindexes;
0181:                DATATYPES = datatypes;
0182:                DATASIGNED = datasigned;
0183:                DATACOLUMNNAMES = datacolumnnames;
0184:                DATACUSTOMTYPES = datacustomtypes;
0185:                DATAPRECISIONS = dataprecisions;
0186:                if (dataredefined == null)
0187:                    DATAREDEFINED = new boolean[DATALENGTHS.length];
0188:                else
0189:                    DATAREDEFINED = dataredefined;
0190:                this .baOutputMessage = baOutputMessage;
0191:                ACTUALROWLENGTH = 0;
0192:                _data = new Vector(DATALENGTHS.length);
0193:                for (int i = 0; i < DATALENGTHS.length; i++) {
0194:                    if (!DATAREDEFINED[i])
0195:                        ACTUALROWLENGTH += DATALENGTHS[i];
0196:                    _data.addElement(null);
0197:                }
0198:                if (CALCROWLENGTH || !MULTIROW)
0199:                    ROWLENGTH = ACTUALROWLENGTH;
0200:            }
0201:
0202:            /**
0203:              To return an array of lengths of the columns in a <CODE>ByteArrayParser</CODE>.
0204:
0205:              <P><PRE>
0206:              Method: public int getDataLengths()
0207:              Visibility: Public
0208:              Purpose:	To return an array of lengths of the columns.
0209:              </PRE></P>
0210:              @return 			Returns the length of the columns in an array.
0211:
0212:             */
0213:            public int[] getDataLengths() {
0214:                return DATALENGTHS;
0215:            }
0216:
0217:            /**
0218:              To return an array of start indexes of the columns in a <CODE>ByteArrayParser</CODE>.
0219:
0220:              <P><PRE>
0221:              Method: public int getDataStartIndexes()
0222:              Visibility: Public
0223:              Purpose:	To return an array of start indexes of the columns.
0224:              </PRE></P>
0225:              @return 			Returns the start index of the columns in an array.
0226:
0227:             */
0228:            public int[] getDataStartIndexes() {
0229:                return DATASTARTINDEXES;
0230:            }
0231:
0232:            /**
0233:              To return an array of types of the columns in a <CODE>ByteArrayParser</CODE>.
0234:
0235:              <P><PRE>
0236:              Method: public int getDataTypes()
0237:              Visibility: Public
0238:              Purpose:	To return an array of types of the columns.
0239:              </PRE></P>
0240:              @return 			Returns the type of the columns in an array.
0241:
0242:             */
0243:            public int[] getDataTypes() {
0244:                return DATATYPES;
0245:            }
0246:
0247:            /**
0248:              To return an array of signed attributes of the columns in a <CODE>ByteArrayParser</CODE>.
0249:
0250:              <P><PRE>
0251:              Method: public int getDataSigned()
0252:              Visibility: Public
0253:              Purpose:	To return an array of signed attribute of the columns.
0254:              </PRE></P>
0255:              @return 			Returns the signed attribute of the columns in an array.
0256:
0257:             */
0258:            public boolean[] getDataSigned() {
0259:                return DATASIGNED;
0260:            }
0261:
0262:            /**
0263:              To return an array of names of the columns in a <CODE>ByteArrayParser</CODE>.
0264:
0265:              <P><PRE>
0266:              Method: public int getDataColumnNames()
0267:              Visibility: Public
0268:              Purpose:	To return an array of names of the columns.
0269:              </PRE></P>
0270:              @return 			Returns the name of the columns in an array.
0271:
0272:             */
0273:            public String[] getDataColumnNames() {
0274:                return DATACOLUMNNAMES;
0275:            }
0276:
0277:            /**
0278:              To return an array of the custom type representation of the columns in a <CODE>ByteArrayParser</CODE>.
0279:
0280:              <P><PRE>
0281:              Method: public int getDataCustomTypes()
0282:              Visibility: Public
0283:              Purpose:	To return an array of custom types of the columns.
0284:              </PRE></P>
0285:              @return 			Returns the custom type of the columns in an array.
0286:
0287:             */
0288:            public CustomType[] getDataCustomTypes() {
0289:                return DATACUSTOMTYPES;
0290:            }
0291:
0292:            /**
0293:              To return an array of precisions of the columns in a <CODE>ByteArrayParser</CODE>.
0294:
0295:              <P><PRE>
0296:              Method: public int getDataPrecisions()
0297:              Visibility: Public
0298:              Purpose:	To return an array of precisions of the columns.
0299:              </PRE></P>
0300:              @return 			Returns the precisions of the columns in an array.
0301:
0302:             */
0303:            public int[] getDataPrecisions() {
0304:                return DATAPRECISIONS;
0305:            }
0306:
0307:            /**
0308:              To set the data lengths of the columns in a <CODE>ByteArrayParser</CODE>.
0309:
0310:              <P><PRE>
0311:              Method: public void setDataLengths(int[] datalengths)
0312:              Visibility: Public
0313:              Purpose:	To set the lengths of the columns in the ByteArrayParser.
0314:              </PRE></P>
0315:              @param datalengths    Sets the data length of the columns in a ByteArrayParser.
0316:             */
0317:            public void setDataLengths(int[] datalengths) {
0318:                DATALENGTHS = datalengths;
0319:            }
0320:
0321:            /**
0322:              To set the data start index of the columns in a <CODE>ByteArrayParser</CODE>.
0323:
0324:              <P><PRE>
0325:              Method: public void setDataStartIndexes(int[] datastartindexes)
0326:              Visibility: Public
0327:              Purpose:	To set the start indexes of the columns in the ByteArrayParser.
0328:              </PRE></P>
0329:              @param datalengths    Sets the data start index of the columns in a ByteArrayParser.
0330:             */
0331:            public void setDataStartIndexes(int[] datastartindexes) {
0332:                DATASTARTINDEXES = datastartindexes;
0333:            }
0334:
0335:            /**
0336:              To set the data types of the columns in a <CODE>ByteArrayParser</CODE>.
0337:
0338:              <P><PRE>
0339:              Method: public void setDataTypes(int[] datatypes)
0340:              Visibility: Public
0341:              Purpose:	To set the types of the columns in the ByteArrayParser.
0342:              </PRE></P>
0343:              @param datalengths    Sets the data type of the columns in a ByteArrayParser.
0344:             */
0345:            public void setDataTypes(int[] datatypes) {
0346:                DATATYPES = datatypes;
0347:            }
0348:
0349:            /**
0350:              To set the data signed attributes of the columns in a <CODE>ByteArrayParser</CODE>.
0351:
0352:              <P><PRE>
0353:              Method: public void setDataSigned(boolean[] datasigned)
0354:              Visibility: Public
0355:              Purpose:	To set the signed attributes of the columns in the ByteArrayParser.
0356:              </PRE></P>
0357:              @param datalengths    Sets the data signed attribute of the columns in a ByteArrayParser.
0358:             */
0359:            public void setDataSigned(boolean[] datasigned) {
0360:                DATASIGNED = datasigned;
0361:            }
0362:
0363:            /**
0364:              To set the column names of the columns in a <CODE>ByteArrayParser</CODE>.
0365:
0366:              <P><PRE>
0367:              Method: public void setDataColumnNames(String[] datacolumnnames)
0368:              Visibility: Public
0369:              Purpose:	To set the names of the columns in the ByteArrayParser.
0370:              </PRE></P>
0371:              @param datalengths    Sets the column name of the columns in a ByteArrayParser.
0372:             */
0373:            public void setDataColumnNames(String[] datacolumnnames) {
0374:                DATACOLUMNNAMES = datacolumnnames;
0375:            }
0376:
0377:            /**
0378:              To set the data custom types of the columns in a <CODE>ByteArrayParser</CODE>.
0379:
0380:              <P><PRE>
0381:              Method: public void setDataCustomTypes(CustomType[] datacustomtypes)
0382:              Visibility: Public
0383:              Purpose:	To set the custom types of the columns in the ByteArrayParser.
0384:              </PRE></P>
0385:              @param datalengths    Sets the data custom type of the columns in a ByteArrayParser.
0386:             */
0387:            public void setDataCustomTypes(CustomType[] datacustomtypes) {
0388:                DATACUSTOMTYPES = datacustomtypes;
0389:            }
0390:
0391:            /**
0392:              To set the data precisions of the columns in a <CODE>ByteArrayParser</CODE>.
0393:
0394:              <P><PRE>
0395:              Method: public void setDataPrecisions(int[] dataprecisions)
0396:              Visibility: Public
0397:              Purpose:	To set the precisions of the columns in the ByteArrayParser.
0398:              </PRE></P>
0399:              @param datalengths    Sets the data precision of the columns in a ByteArrayParser.
0400:             */
0401:            public void setDataPrecisions(int[] dataprecisions) {
0402:                DATAPRECISIONS = dataprecisions;
0403:            }
0404:
0405:            /**
0406:              To set the <CODE>ByteArrayParser</CODE> to multirow.
0407:            
0408:              <P><PRE>
0409:              Method: public void setMultiRow(int iRowLength) throws Exception
0410:              Visibility: Public
0411:              Purpose:	To indicate message contains multiple rows and optionally the
0412:            			length of a row. An iRowLength of zero indicates to calculate
0413:            			Column Definitions.
0414:              </PRE></P>
0415:              @param iRowLength			 	Specifies the length of a row. If zero Row Length Automatically Calculated from Column Definitions.
0416:              @exception	ParserException		<P><PRE>Throws two possible Exceptions under these Circumstances.
0417:            								Circumstance 1: If Calculated Row Length is Greater than Specified Row Length.
0418:            								Circumstance 2: If Specified Row Length does not divide Evenly into Length of Message.
0419:            								</PRE></P>
0420:             */
0421:
0422:            public void setMultiRow(int iRowLength) throws ParserException {
0423:                MULTIROW = true;
0424:                ROWLENGTH = iRowLength;
0425:                if (ROWLENGTH != 0)
0426:                    CALCROWLENGTH = false;
0427:                else
0428:                    CALCROWLENGTH = true;
0429:                ACTUALROWLENGTH = 0;
0430:                for (int i = 0; i < DATALENGTHS.length; i++) {
0431:                    if (!DATAREDEFINED[i])
0432:                        ACTUALROWLENGTH += DATALENGTHS[i];
0433:                }
0434:                if (CALCROWLENGTH)
0435:                    ROWLENGTH = ACTUALROWLENGTH;
0436:                if (ACTUALROWLENGTH > ROWLENGTH)
0437:                    throw new ParserException(
0438:                            "Actual Row Length has Exceeded Specified Row Length "
0439:                                    + ROWLENGTH);
0440:                if (ROWLENGTH != 0 && !CALCROWLENGTH
0441:                        && baOutputMessage.length % ROWLENGTH != 0)
0442:                    throw new ParserException(
0443:                            "Specified Row Length does not divide evenly into Message Length"
0444:                                    + baOutputMessage.length);
0445:            }
0446:
0447:            /**
0448:              To add a column definition to a <CODE>ByteArrayParser</CODE>.
0449:            
0450:              <P><PRE>
0451:              Method: public void addColumnDefinition(int iColumnNumber,String sColumnName,int iType,int iStartIndex,int iLength,boolean bSigned) throws ArrayIndexOutOfBoundsException,Exception
0452:              Visibility: Public
0453:              Purpose:	To specify a column definition to be in used parsing the data 
0454:            			contained in message.
0455:              </PRE></P>
0456:              @param iColumnNumber		 	Specifies Column position in a Row. 
0457:              @param sColumnName		  	Specifies Name of Column.
0458:              @param iType					Specifies the Format Type of Column. Valid values range 1-7. Public Constants exist for these values.
0459:              @param iStartIndex			Specifies the start index of a Column in Row portion of the message. 
0460:              @param iLength				Specifies the length of a Column in a Row portion of the message.
0461:              @param bSigned				Indicates in Columns data is signed.
0462:              @exception	ArrayIndexOutOfBoundsException	<P><PRE>Throws two possible Exceptions under these Circumstances.
0463:            												Circumstance 1: If iColumnNumber is greater than specified number of Columns.
0464:            												Circumstance 2: If iStartIndex plus iLength is greater than length of Message.
0465:            												</PRE></P>
0466:              @exception	Exception		<P><PRE>Throws one possible Exception under this Circumstance.
0467:            								Circumstance 1: If Calculated Row Length is Greater than Specified Row Length.
0468:            								</PRE></P>
0469:              
0470:             */
0471:
0472:            public void addColumnDefinition(int iColumnNumber,
0473:                    String sColumnName, int iType, int iStartIndex,
0474:                    int iLength, boolean bSigned)
0475:                    throws ArrayIndexOutOfBoundsException, ParserException {
0476:                int iTempStartIndex = iStartIndex;
0477:                int iTempColumnNumber = iColumnNumber;
0478:                if (iTempColumnNumber >= DATALENGTHS.length
0479:                        || iTempColumnNumber < 0)
0480:                    throw new ArrayIndexOutOfBoundsException("Column "
0481:                            + iTempColumnNumber + ": " + sColumnName
0482:                            + " is out of Bounds");
0483:                if (iTempStartIndex + iLength > baOutputMessage.length
0484:                        || iTempStartIndex < 0)
0485:                    throw new ArrayIndexOutOfBoundsException(
0486:                            "The sum of Start Index " + iTempStartIndex
0487:                                    + " and Length " + iLength
0488:                                    + " is out of Bounds for Column "
0489:                                    + iTempColumnNumber + ": " + sColumnName);
0490:                STARTINDEX = iStartIndex;
0491:                STARTFIELD = iColumnNumber;
0492:                DATALENGTHS[iTempColumnNumber] = iLength;
0493:                DATASTARTINDEXES[iTempColumnNumber] = iTempStartIndex;
0494:                DATATYPES[iTempColumnNumber] = iType;
0495:                if (iType == TYPE_FLOAT || iType == TYPE_DOUBLE)
0496:                    DATAPRECISIONS[iTempColumnNumber] = 2;
0497:                DATASIGNED[iTempColumnNumber] = bSigned;
0498:                DATACOLUMNNAMES[iTempColumnNumber] = sColumnName;
0499:                STARTINDEX += iLength;
0500:                STARTFIELD++;
0501:                ACTUALROWLENGTH = 0;
0502:                for (int i = 0; i < DATALENGTHS.length; i++) {
0503:                    if (!DATAREDEFINED[i])
0504:                        ACTUALROWLENGTH += DATALENGTHS[i];
0505:                }
0506:                if (CALCROWLENGTH || !MULTIROW)
0507:                    ROWLENGTH = ACTUALROWLENGTH;
0508:                if (ACTUALROWLENGTH > ROWLENGTH)
0509:                    throw new ParserException(
0510:                            "Actual Row Length has Exceeded Specified Row Length "
0511:                                    + ROWLENGTH + " for Column "
0512:                                    + iTempColumnNumber + ": " + sColumnName);
0513:            }
0514:
0515:            /**
0516:              To add a column definition to a <CODE>ByteArrayParser</CODE>.
0517:            
0518:              <P><PRE>
0519:              Method: public void addColumnDefinition(int iColumnNumber,String sColumnName,CustomType ctType,int iStartIndex,int iLength,boolean bSigned) throws ArrayIndexOutOfBoundsException,Exception
0520:              Visibility: Public
0521:              Purpose:	To specify a column definition to be in used parsing the data 
0522:            			contained in message.
0523:              </PRE></P>
0524:              @param iColumnNumber		 	Specifies Column position in a Row. If Negative	it uses last known column position + 1;
0525:              @param sColumnName		    Specifies Name of Column.
0526:              @param ctType					Specifies an instance of an object that implements CustomType Format of Column.
0527:              @param iStartIndex			Specifies the start index of a Column in Row portion of the message.										
0528:              @param iLength				Specifies the length of a Column in a Row portion of the message.
0529:              @param bSigned				Indicates in Columns data is signed.
0530:              @exception	ArrayIndexOutOfBoundsException	<P><PRE>Throws two possible Exceptions under these Circumstances.
0531:            												Circumstance 1: If iColumnNumber is greater than specified number of Columns.
0532:            												Circumstance 2: If iStartIndex plus iLength is greater than length of Message.
0533:            												</PRE></P>
0534:              @exception	Exception		<P><PRE>Throws one possible Exception under this Circumstance.
0535:            								Circumstance 1: If Calculated Row Length is Greater than Specified Row Length.
0536:            								</PRE></P>
0537:             */
0538:
0539:            public void addColumnDefinition(int iColumnNumber,
0540:                    String sColumnName, CustomType ctType, int iStartIndex,
0541:                    int iLength, boolean bSigned)
0542:                    throws ArrayIndexOutOfBoundsException, ParserException {
0543:                addColumnDefinition(iColumnNumber, sColumnName, TYPE_STRING,
0544:                        iStartIndex, iLength, bSigned);
0545:                DATATYPES[iColumnNumber] = TYPE_CUSTOM;
0546:                DATACUSTOMTYPES[iColumnNumber] = ctType;
0547:            }
0548:
0549:            /**
0550:              To add a column definition to a <CODE>ByteArrayParser</CODE>.
0551:            
0552:              <P><PRE>
0553:              Method: public void addColumnDefinition(int iColumnNumber,String sColumnName,int iType,int iStartIndex,int iLength,boolean bSigned) throws ArrayIndexOutOfBoundsException,Exception
0554:              Visibility: Public
0555:              Purpose:	To specify a column definition to be in used parsing the data 
0556:            			contained in message.
0557:              </PRE></P>
0558:              @param iColumnNumber		 	Specifies Column position in a Row. 
0559:              @param sColumnName		    Specifies Name of Column.
0560:              @param iType					Specifies the Format Type of Column. Valid values range 1-7. Public Constants exist for these values.
0561:              @param iPrecision				Specifies the precison of the Float date.
0562:              @param iStartIndex			Specifies the start index of a Column in Row portion of the message. 
0563:              @param iLength				Specifies the length of a Column in a Row portion of the message.
0564:              @param bSigned				Indicates in Columns data is signed.
0565:              @exception	ArrayIndexOutOfBoundsException	<P><PRE>Throws two possible Exceptions under these Circumstances.
0566:            												Circumstance 1: If iColumnNumber is greater than specified number of Columns.
0567:            												Circumstance 2: If iStartIndex plus iLength is greater than length of Message.
0568:            												</PRE></P>
0569:              @exception	Exception		<P><PRE>Throws one possible Exception under this Circumstance.
0570:            								Circumstance 1: If Calculated Row Length is Greater than Specified Row Length.
0571:            								</PRE></P>
0572:             */
0573:
0574:            public void addColumnDefinition(int iColumnNumber,
0575:                    String sColumnName, int iType, int iPrecision,
0576:                    int iStartIndex, int iLength, boolean bSigned)
0577:                    throws ArrayIndexOutOfBoundsException, ParserException {
0578:                addColumnDefinition(iColumnNumber, sColumnName, iType,
0579:                        iStartIndex, iLength, bSigned);
0580:                DATAPRECISIONS[iColumnNumber] = iPrecision;
0581:            }
0582:
0583:            /**
0584:              To add a column definition to a <CODE>ByteArrayParser</CODE>.
0585:            
0586:              <P><PRE>
0587:              Method: public void addColumnDefinition(String sColumnName,int iType,int iLength,boolean bSigned) throws ArrayIndexOutOfBoundsException,Exception
0588:              Visibility: Public
0589:              Purpose:	To specify a column definition to be in used parsing the data 
0590:            			contained in message.
0591:              </PRE></P>
0592:              @param sColumnName		    Specifies Name of Column.
0593:              @param iType					Specifies the Format Type of Column.Valid values range 1-7. Public Constants exist for these values.
0594:              @param iLength				Specifies the length of a Column in a Row portion of the message.
0595:              @param bSigned				Indicates in Columns data is signed.
0596:              @exception	ArrayIndexOutOfBoundsException	<P><PRE>Throws two possible Exceptions under these Circumstances.
0597:            												Circumstance 1: If iColumnNumber is greater than specified number of Columns.
0598:            												Circumstance 2: If iStartIndex plus iLength is greater than length of Message.
0599:            												</PRE></P>
0600:              @exception	Exception		<P><PRE>Throws one possible Exception under this Circumstance.
0601:            								Circumstance 1: If Calculated Row Length is Greater than Specified Row Length.
0602:            								</PRE></P>
0603:             */
0604:
0605:            public void addColumnDefinition(String sColumnName, int iType,
0606:                    int iLength, boolean bSigned)
0607:                    throws ArrayIndexOutOfBoundsException, ParserException {
0608:                int iTempStartIndex = STARTINDEX;
0609:                int iTempColumnNumber = STARTFIELD;
0610:                if (iTempColumnNumber >= DATALENGTHS.length
0611:                        || iTempColumnNumber < 0)
0612:                    throw new ArrayIndexOutOfBoundsException("Column "
0613:                            + iTempColumnNumber + ": " + sColumnName
0614:                            + " is out of Bounds");
0615:                if (iTempStartIndex + iLength > baOutputMessage.length
0616:                        || iTempStartIndex < 0)
0617:                    throw new ArrayIndexOutOfBoundsException(
0618:                            "The sum of Start Index " + iTempStartIndex
0619:                                    + " and Length " + iLength
0620:                                    + " is out of Bounds for Column "
0621:                                    + iTempColumnNumber + ": " + sColumnName);
0622:                DATALENGTHS[iTempColumnNumber] = iLength;
0623:                DATASTARTINDEXES[iTempColumnNumber] = iTempStartIndex;
0624:                DATATYPES[iTempColumnNumber] = iType;
0625:                if (iType == TYPE_FLOAT || iType == TYPE_DOUBLE)
0626:                    DATAPRECISIONS[iTempColumnNumber] = 2;
0627:                DATASIGNED[iTempColumnNumber] = bSigned;
0628:                DATACOLUMNNAMES[iTempColumnNumber] = sColumnName;
0629:                STARTINDEX += iLength;
0630:                STARTFIELD++;
0631:                ACTUALROWLENGTH = 0;
0632:                for (int i = 0; i < DATALENGTHS.length; i++) {
0633:                    if (!DATAREDEFINED[i])
0634:                        ACTUALROWLENGTH += DATALENGTHS[i];
0635:                }
0636:                if (CALCROWLENGTH || !MULTIROW)
0637:                    ROWLENGTH = ACTUALROWLENGTH;
0638:                if (ACTUALROWLENGTH > ROWLENGTH)
0639:                    throw new ParserException(
0640:                            "Actual Row Length has Exceeded Specified Row Length "
0641:                                    + ROWLENGTH + " for Column "
0642:                                    + iTempColumnNumber + ": " + sColumnName);
0643:            }
0644:
0645:            /**
0646:              To add a column definition to a <CODE>ByteArrayParser</CODE>.
0647:            
0648:              <P><PRE>
0649:              Method: public void addColumnDefinition(String sColumnName,CustomType ctType,int iLength,boolean bSigned) throws ArrayIndexOutOfBoundsException,Exception
0650:              Visibility: Public
0651:              Purpose:	To specify a column definition to be in used parsing the data 
0652:            			contained in message.
0653:              </PRE></P>
0654:              @param iColumnNumber		 	Specifies Column position in a Row. If Negative it uses last known column position + 1;
0655:              @param sColumnName		    Specifies Name of Column.
0656:              @param ctType					Specifies an instance of an object that implements CustomType Format of Column.
0657:              @param iStartIndex			Specifies the start index of a Column in Row portion of the message.										
0658:              @param iLength				Specifies the length of a Column in a Row portion of the message.
0659:              @param bSigned				Indicates in Columns data is signed.
0660:              @exception	ArrayIndexOutOfBoundsException	<P><PRE>Throws two possible Exceptions under these Circumstances.
0661:            												Circumstance 1: If iColumnNumber is greater than specified number of Columns.
0662:            												Circumstance 2: If iStartIndex plus iLength is greater than length of Message.
0663:            												</PRE></P>
0664:              @exception	Exception		<P><PRE>Throws one possible Exception under this Circumstance.
0665:            								Circumstance 1: If Calculated Row Length is Greater than Specified Row Length.
0666:            								</PRE></P>
0667:             */
0668:
0669:            public void addColumnDefinition(String sColumnName,
0670:                    CustomType ctType, int iLength, boolean bSigned)
0671:                    throws ArrayIndexOutOfBoundsException, ParserException {
0672:                int iTempColumnNumber = STARTFIELD;
0673:                addColumnDefinition(sColumnName, TYPE_STRING, iLength, bSigned);
0674:                DATATYPES[iTempColumnNumber] = TYPE_CUSTOM;
0675:                DATACUSTOMTYPES[iTempColumnNumber] = ctType;
0676:            }
0677:
0678:            /**
0679:              To add a column definition to a <CODE>ByteArrayParser</CODE>.
0680:            
0681:              <P><PRE>
0682:              Method: public void addColumnDefinition(String sColumnName,int iType,int iLength,boolean bSigned) throws ArrayIndexOutOfBoundsException,Exception
0683:              Visibility: Public
0684:              Purpose:	To specify a column definition to be in used parsing the data 
0685:            			contained in message.
0686:              </PRE></P>
0687:              @param sColumnName		   	Specifies Name of Column.
0688:              @param iType				   	Specifies the Format Type of Column. Valid values range 1-7. Public Constants exist for these values.
0689:              @param iPrecision			   	Specifies the precison of the Float date.
0690:              @param iLength			   	Speifies the length of a Column in a Row portion of the message.
0691:              @param bSigned				Indicates in Columns data is signed.
0692:              @exception	ArrayIndexOutOfBoundsException	<P><PRE>Throws two possible Exceptions under these Circumstances.
0693:            												Circumstance 1: If iColumnNumber is greater than specified number of Columns.
0694:            												Circumstance 2: If iStartIndex plus iLength is greater than length of Message.
0695:            												</PRE></P>
0696:              @exception	Exception		<P><PRE>Throws one possible Exception under this Circumstance.
0697:            								Circumstance 1: If Calculated Row Length is Greater than Specified Row Length.
0698:            								</PRE></P>
0699:             */
0700:
0701:            public void addColumnDefinition(String sColumnName, int iType,
0702:                    int iPrecision, int iLength, boolean bSigned)
0703:                    throws ArrayIndexOutOfBoundsException, ParserException {
0704:                int iTempColumnNumber = STARTFIELD;
0705:                addColumnDefinition(sColumnName, iType, iLength, bSigned);
0706:                DATAPRECISIONS[iTempColumnNumber] = iPrecision;
0707:            }
0708:
0709:            /**
0710:              To perofrm the parsing of a <CODE>ByteArrayParser</CODE>.
0711:            
0712:              <P><PRE>
0713:              Method: public Vector doParse() throws Exception
0714:              Visibility: Public
0715:              Purpose:	To return a row in the message, each call returns the next row
0716:            			in message if more than one.
0717:              </PRE></P>			
0718:              @return 			Returns A Vector containing the data of one row in the message. Null indicates last row reached.													
0719:              @exception	Exception	<P><PRE>Throws two possible Exceptions under these Circumstances.
0720:            							Circumstance 1: If no Column Definitions have been defined. 
0721:            							Circumstance 2: If Specified Row Length does not divide Evenly into Length of Message.
0722:            							</PRE></P>
0723:             */
0724:
0725:            public Vector doParse() throws ParserException {
0726:                if (ROWLENGTH == 0)
0727:                    throw new ParserException("No Column Definition Specified");
0728:                if (ROWLENGTH != 0 && MULTIROW && CALCROWLENGTH
0729:                        && baOutputMessage.length % ROWLENGTH != 0)
0730:                    throw new ParserException(
0731:                            "Calculated Row Length does not divide evenly into Message Length"
0732:                                    + baOutputMessage.length);
0733:                if (OFFSET >= baOutputMessage.length)
0734:                    return null;
0735:                for (int i = 0; i < _data.size(); i++)
0736:                    _data.setElementAt(null, i);
0737:                /*File f=null;
0738:                FileOutputStream fs=null;
0739:                PrintStream ps=null;
0740:                try {
0741:                  f=new File("C:\\LOGS\\"+System.currentTimeMillis()+".PRS");
0742:                  fs=new FileOutputStream(f);  
0743:                  ps=new PrintStream(fs);
0744:                 }
0745:                catch (Exception e){
0746:                  Debugger.println("File IO Exception: "+e);
0747:                 }*/
0748:                int iElement = 0;
0749:                StringBuffer sbData = new StringBuffer();
0750:                try {
0751:                    for (iElement = 0; iElement < DATALENGTHS.length; iElement++) {
0752:                        _data.setElementAt(getParsedObject(iElement), iElement);
0753:                    }
0754:                    nextOffset();
0755:                } catch (Exception e) {
0756:                    MessageLog.writeDebugMessage("Exception Occured on "
0757:                            + DATACOLUMNNAMES[iElement] + " field from this '"
0758:                            + sbData + "' : " + e, this );
0759:                    //ps.println("Exception Occured on "+iElement+" field: "+e);
0760:                    MessageLog.writeDebugMessage(iElement + " field DataType: "
0761:                            + DATATYPES[iElement], this );
0762:                    //ps.println(iElement+" field DataType: "+DATATYPES[iElement]);
0763:                    MessageLog.writeDebugMessage(iElement + " field Length: "
0764:                            + DATALENGTHS[iElement], this );
0765:                    //ps.println(iElement+" field Length: "+DATALENGTHS[iElement]);
0766:                    MessageLog.writeDebugMessage(iElement + " field Signed: "
0767:                            + DATASIGNED[iElement], this );
0768:                    //ps.println(iElement+" field Signed: "+DATASIGNED[iElement]);
0769:                }
0770:                //Debugger.println("Final FIeld Number is "+iElement);
0771:                //ps.println("Final FIeld Number is "+iElement);
0772:                //ps.close();
0773:                /*try {
0774:                  fs.close();
0775:                 }
0776:                catch (Exception e) {
0777:                  Debugger.println("File IO Exception: "+e);
0778:                 }*/
0779:                return _data;
0780:            }
0781:
0782:            public void nextOffset() {
0783:                CURRENTROWOFFSET = OFFSET;
0784:                if (MULTIROW)
0785:                    OFFSET = OFFSET + ROWLENGTH;
0786:                else
0787:                    OFFSET = 0;
0788:            }
0789:
0790:            public void nextRow() {
0791:                for (int i = 0; i < _data.size(); i++)
0792:                    _data.setElementAt(null, i);
0793:                if (MULTIROW) {
0794:                    CURRENTROWOFFSET = CURRENTROWOFFSET + ROWLENGTH;
0795:                } else {
0796:                    CURRENTROWOFFSET = 0;
0797:                }
0798:            }
0799:
0800:            private Object getParsedObject(int iElement) {
0801:                return getParsedObject(iElement, OFFSET);
0802:            }
0803:
0804:            private Object getParsedObject(int iElement, int OFFSET) {
0805:                StringBuffer sbData = new StringBuffer(new String(
0806:                        baOutputMessage, OFFSET + DATASTARTINDEXES[iElement],
0807:                        DATALENGTHS[iElement]));
0808:                StringBuffer sbDebug = new StringBuffer("sData for ");
0809:                sbDebug.append(DATACOLUMNNAMES[iElement]);
0810:                sbDebug.append(" is ");
0811:                sbDebug.append(sbData);
0812:                MessageLog.writeDebugMessage(sbDebug.toString(), this );
0813:                //ps.println("sData for "+DATACOLUMNNAMES[iElement]+" is "+sData);
0814:                if (DATASIGNED[iElement]) {
0815:                    //Debugger.println("Sign Conversion");
0816:                    //ps.println("Sign Conversion");
0817:                    char cSignedChar = sbData.charAt(sbData.length() - 1);
0818:                    String sUnsignedData = sbData.substring(0,
0819:                            sbData.length() - 1);
0820:                    switch (cSignedChar) {
0821:                    case '{':
0822:                        sbData.replace(0, sbData.length(), sUnsignedData);
0823:                        sbData.append('0');
0824:                        break;
0825:                    case 'A':
0826:                        sbData.replace(0, sbData.length(), sUnsignedData);
0827:                        sbData.append('1');
0828:                        break;
0829:                    case 'B':
0830:                        sbData.replace(0, sbData.length(), sUnsignedData);
0831:                        sbData.append('2');
0832:                        break;
0833:                    case 'C':
0834:                        sbData.replace(0, sbData.length(), sUnsignedData);
0835:                        sbData.append('3');
0836:                        break;
0837:                    case 'D':
0838:                        sbData.replace(0, sbData.length(), sUnsignedData);
0839:                        sbData.append('4');
0840:                        break;
0841:                    case 'E':
0842:                        sbData.replace(0, sbData.length(), sUnsignedData);
0843:                        sbData.append('5');
0844:                        break;
0845:                    case 'F':
0846:                        sbData.replace(0, sbData.length(), sUnsignedData);
0847:                        sbData.append('6');
0848:                        break;
0849:                    case 'G':
0850:                        sbData.replace(0, sbData.length(), sUnsignedData);
0851:                        sbData.append('7');
0852:                        break;
0853:                    case 'H':
0854:                        sbData.replace(0, sbData.length(), sUnsignedData);
0855:                        sbData.append('8');
0856:                        break;
0857:                    case 'I':
0858:                        sbData.replace(0, sbData.length(), sUnsignedData);
0859:                        sbData.append('9');
0860:                        break;
0861:                    case '}':
0862:                        sbData.replace(0, sbData.length(), sUnsignedData);
0863:                        sbData.insert(0, cNegativeSign);
0864:                        sbData.append('0');
0865:                        break;
0866:                    case 'J':
0867:                        sbData.replace(0, sbData.length(), sUnsignedData);
0868:                        sbData.insert(0, cNegativeSign);
0869:                        sbData.append('1');
0870:                        break;
0871:                    case 'K':
0872:                        sbData.replace(0, sbData.length(), sUnsignedData);
0873:                        sbData.insert(0, cNegativeSign);
0874:                        sbData.append('2');
0875:                        break;
0876:                    case 'L':
0877:                        sbData.replace(0, sbData.length(), sUnsignedData);
0878:                        sbData.insert(0, cNegativeSign);
0879:                        sbData.append('3');
0880:                        break;
0881:                    case 'M':
0882:                        sbData.replace(0, sbData.length(), sUnsignedData);
0883:                        sbData.insert(0, cNegativeSign);
0884:                        sbData.append('4');
0885:                        break;
0886:                    case 'N':
0887:                        sbData.replace(0, sbData.length(), sUnsignedData);
0888:                        sbData.insert(0, cNegativeSign);
0889:                        sbData.append('5');
0890:                        break;
0891:                    case 'O':
0892:                        sbData.replace(0, sbData.length(), sUnsignedData);
0893:                        sbData.insert(0, cNegativeSign);
0894:                        sbData.append('6');
0895:                        break;
0896:                    case 'P':
0897:                        sbData.replace(0, sbData.length(), sUnsignedData);
0898:                        sbData.insert(0, cNegativeSign);
0899:                        sbData.append('7');
0900:                        break;
0901:                    case 'Q':
0902:                        sbData.replace(0, sbData.length(), sUnsignedData);
0903:                        sbData.insert(0, cNegativeSign);
0904:                        sbData.append('8');
0905:                        break;
0906:                    case 'R':
0907:                        sbData.replace(0, sbData.length(), sUnsignedData);
0908:                        sbData.insert(0, cNegativeSign);
0909:                        sbData.append('9');
0910:                        break;
0911:                    }
0912:                    sbDebug.replace(0, sbDebug.length(),
0913:                            "Sign Converted sData is ");
0914:                    sbDebug.append(sbData);
0915:                    MessageLog.writeDebugMessage(sbDebug.toString(), this );
0916:                    //ps.println("Sign Converted sData is "+sData);
0917:                    if (sbData != null) {
0918:                        //ps.println("Sign Converted sData is "+sData);
0919:                    } else {
0920:                        //ps.println("Sign Converted sData is null");
0921:                        sbData = sbData.replace(0, sbData.length(), "+0");
0922:                    }
0923:                }
0924:                Object oReturn;
0925:                switch (DATATYPES[iElement]) {
0926:                case TYPE_CUSTOM:
0927:                    //			   _data.addElement(DATACUSTOMTYPES[iElement].getDataValue(sbData.toString()));
0928:                    oReturn = DATACUSTOMTYPES[iElement].getDataValue(sbData
0929:                            .toString());
0930:                    break;
0931:                case TYPE_INT:
0932:                    sbData
0933:                            .replace(0, sbData.length(), sbData.toString()
0934:                                    .trim());
0935:                    try {
0936:                        new Float(sbData.toString());
0937:                    } catch (NumberFormatException e) {
0938:                        sbData.replace(0, sbData.length(), "0");
0939:                    }
0940:                    //		       _data.addElement(new Integer(sbData.toString()));
0941:                    oReturn = new Integer(sbData.toString());
0942:                    break;
0943:                case TYPE_STRING:
0944:                    //			   _data.addElement(sbData.toString());
0945:                    oReturn = sbData.toString();
0946:                    break;
0947:                case TYPE_CHAR:
0948:                    //			   _data.addElement(new Character(sbData.charAt(0)));
0949:                    oReturn = new Character(sbData.charAt(0));
0950:                    break;
0951:                case TYPE_FLOAT: {
0952:                    int iPrecision = DATAPRECISIONS[iElement];
0953:                    try {
0954:                        new Float(sbData.toString().trim());
0955:                    } catch (NumberFormatException e) {
0956:                        sbData.replace(0, sbData.length(), padString("",
0957:                                iPrecision + 1, '0'));
0958:                    }
0959:                    if (sbData.toString().trim().length() < (iPrecision + 1))
0960:                        sbData.replace(0, sbData.length(), padString("",
0961:                                iPrecision + 1, '0'));
0962:
0963:                    sbData
0964:                            .replace(0, sbData.length(), sbData.toString()
0965:                                    .trim());
0966:                    String sIntPart = sbData.substring(0, sbData.length()
0967:                            - iPrecision);
0968:                    sbDebug.replace(0, sbDebug.length(), "sIntPart=");
0969:                    sbDebug.append(sIntPart);
0970:                    MessageLog.writeDebugMessage(sbDebug.toString(), this );
0971:                    String sDecPart = sbData.substring(sbData.length()
0972:                            - iPrecision);
0973:                    sbDebug.replace(0, sbDebug.length(), "sDecPart=");
0974:                    sbDebug.append(sDecPart);
0975:                    MessageLog.writeDebugMessage(sbDebug.toString(), this );
0976:                    StringBuffer sbFloat = new StringBuffer(sIntPart);
0977:                    sbFloat.append(cDecimalSeparator);
0978:                    sbFloat.append(sDecPart);
0979:                    sbDebug.replace(0, sbDebug.length(), "sbFloat=");
0980:                    sbDebug.append(sbFloat.toString());
0981:                    MessageLog.writeDebugMessage(sbDebug.toString(), this );
0982:                    Float fFloat = new Float(sbFloat.toString());
0983:                    sbDebug.replace(0, sbDebug.length(), "fFloat=");
0984:                    sbDebug.append(fFloat.floatValue());
0985:                    MessageLog.writeDebugMessage(sbDebug.toString(), this );
0986:                    //	    	   _data.addElement(fFloat);
0987:                    oReturn = fFloat;
0988:                    break;
0989:                }
0990:                case TYPE_DOUBLE: {
0991:                    int iPrecision = DATAPRECISIONS[iElement];
0992:                    try {
0993:                        new Double(sbData.toString().trim());
0994:                    } catch (NumberFormatException e) {
0995:                        sbData.replace(0, sbData.length(), padString("",
0996:                                iPrecision + 1, '0'));
0997:                    }
0998:                    if (sbData.toString().trim().length() < (iPrecision + 1))
0999:                        sbData.replace(0, sbData.length(), padString("",
1000:                                iPrecision + 1, '0'));
1001:
1002:                    sbData
1003:                            .replace(0, sbData.length(), sbData.toString()
1004:                                    .trim());
1005:                    String sIntPart = sbData.substring(0, sbData.length()
1006:                            - iPrecision);
1007:                    String sDecPart = sbData.substring(sbData.length()
1008:                            - iPrecision);
1009:                    StringBuffer sbDouble = new StringBuffer(sIntPart);
1010:                    sbDouble.append(cDecimalSeparator);
1011:                    sbDouble.append(sDecPart);
1012:                    Double dDouble = new Double(sbDouble.toString());
1013:                    //	    	   _data.addElement(dDouble);
1014:                    oReturn = dDouble;
1015:                    break;
1016:                }
1017:                case TYPE_DATE_CCYYMMDD: {
1018:                    int iYear;
1019:                    int iMonth;
1020:                    int iDay;
1021:                    try {
1022:                        iYear = (new Integer(sbData.substring(0, 4)))
1023:                                .intValue();
1024:                        iMonth = (new Integer(sbData.substring(4, 6)))
1025:                                .intValue();
1026:                        iDay = (new Integer(sbData.substring(6))).intValue();
1027:                    } catch (NumberFormatException e) {
1028:                        iYear = 1950;
1029:                        iMonth = 1;
1030:                        iDay = 1;
1031:                    } catch (StringIndexOutOfBoundsException e) {
1032:                        iYear = 1950;
1033:                        iMonth = 1;
1034:                        iDay = 1;
1035:                    }
1036:                    if (iDay == 0)
1037:                        iDay = 1;
1038:                    if (!sbData.toString().trim().equals("")
1039:                            && !sbData.toString().trim().equals("00000000")) {
1040:                        //			     _data.addElement(new java.sql.Date(iYear-1900,iMonth-1,iDay));
1041:                        oReturn = new java.sql.Date(iYear - 1900, iMonth - 1,
1042:                                iDay);
1043:                    } else {
1044:                        //_data.addElement(null);
1045:                        oReturn = null;
1046:                    }
1047:                    break;
1048:                }
1049:                case TYPE_DATE_MMYY: {
1050:                    StringBuffer sbDate = new StringBuffer(sbData.substring(0,
1051:                            2));
1052:                    sbDate.append(cDateSeparator);
1053:                    sbDate.append(sbData.substring(2));
1054:                    //			   _data.addElement(sbDate.toString());
1055:                    oReturn = sbDate.toString();
1056:                    break;
1057:                }
1058:                case TYPE_DATE_YYMM: {
1059:                    StringBuffer sbDate = new StringBuffer(sbData.substring(0,
1060:                            2));
1061:                    sbDate.append(cDateSeparator);
1062:                    sbDate.append(sbData.substring(2));
1063:                    //			   _data.addElement(sbDate.toString());
1064:                    oReturn = sbDate.toString();
1065:                    break;
1066:                }
1067:                default:
1068:                    //			   _data.addElement(sbData.toString());
1069:                    oReturn = sbData.toString();
1070:                }
1071:                return oReturn;
1072:            }
1073:
1074:            /**
1075:              To return the number of columns in a <CODE>ByteArrayParser</CODE>.
1076:            
1077:              <P><PRE>
1078:              Method: public int getColumnCount()
1079:              Visibility: Public
1080:              Purpose:	To return the number of column in a row.
1081:              </PRE></P>
1082:              @return 			Returns the number of columns in a row.
1083:            
1084:             */
1085:
1086:            public int getColumnCount() {
1087:                return DATALENGTHS.length;
1088:            }
1089:
1090:            /**
1091:              To get the column name of a specified column number in a <CODE>ByteArrayParser</CODE>.
1092:            
1093:              <P><PRE>
1094:              Method: public String getColumnName(int iColumn)
1095:              Visibility: Public
1096:              Purpose:	To return the name of a column.
1097:              </PRE></P>
1098:              @param iColumn			Specifies the Column Number.
1099:              @return					Returns the name assigned to a specific column.
1100:             */
1101:
1102:            public String getColumnName(int iColumn) {
1103:                return DATACOLUMNNAMES[iColumn];
1104:            }
1105:
1106:            /**
1107:              To get the column type of a specified column in a <CODE>ByteArrayParser</CODE>.
1108:            
1109:              <P><PRE>
1110:              Method: public int getSqlColumnType(int iColumn)
1111:              Visibility: Public
1112:              Purpose:	To return the sql type of a specified column.
1113:              </PRE></P>
1114:              @param iColumn		 	Specifies the Column Number.
1115:              @return					Returns the sql type of the specified column.
1116:             */
1117:
1118:            public int getSqlColumnType(int iColumn) {
1119:                int ret = 0;
1120:                switch (DATATYPES[iColumn]) {
1121:                case TYPE_CUSTOM:
1122:                    ret = java.sql.Types.VARCHAR;
1123:                    break;
1124:                case TYPE_INT:
1125:                    ret = java.sql.Types.INTEGER;
1126:                    break;
1127:                case TYPE_STRING:
1128:                    ret = java.sql.Types.VARCHAR;
1129:                    break;
1130:                case TYPE_CHAR:
1131:                    ret = java.sql.Types.CHAR;
1132:                    break;
1133:                case TYPE_FLOAT:
1134:                    ret = java.sql.Types.FLOAT;
1135:                    break;
1136:                case TYPE_DOUBLE:
1137:                    ret = java.sql.Types.DOUBLE;
1138:                    break;
1139:                case TYPE_DATE_CCYYMMDD:
1140:                    ret = java.sql.Types.DATE;
1141:                    break;
1142:                case TYPE_DATE_MMYY:
1143:                    ret = java.sql.Types.VARCHAR;
1144:                    break;
1145:                case TYPE_DATE_YYMM:
1146:                    ret = java.sql.Types.VARCHAR;
1147:                    break;
1148:                case TYPE_DATE_MMDDCCYY:
1149:                    ret = java.sql.Types.DATE;
1150:                    break;
1151:                case TYPE_TIME_HHMMSS:
1152:                    ret = java.sql.Types.TIME;
1153:                    break;
1154:                }
1155:                return ret;
1156:            }
1157:
1158:            /**
1159:              To get the column type of a specified column in a <CODE>ByteArrayParser</CODE>.
1160:
1161:              <P><PRE>
1162:              Method: public int getColumnType(int iColumn)
1163:              Visibility: Public
1164:              Purpose:	To return the column type of a specified column.
1165:              </PRE></P>
1166:              @param iColumn		 	Specifies the Column Number.
1167:              @return					Returns the sql type of the specified column.
1168:             */
1169:
1170:            public int getColumnType(int iColumn) {
1171:                int ret = DATATYPES[iColumn];
1172:                return ret;
1173:            }
1174:
1175:            /**
1176:              To get a column precision of a specified column in a <CODE>ByteArrayParser</CODE>.
1177:            
1178:              <P><PRE>
1179:              Method: public int getPrecision(int iColumn)
1180:              Visibility: Public
1181:              Purpose:	To return the precision of a specified column.
1182:              </PRE></P>
1183:              @param iColumn		 	Specifies the Column Number.
1184:              @return 					Returns the precision of the specified column.
1185:             */
1186:
1187:            public int getPrecision(int iColumn) {
1188:                int precision = DATAPRECISIONS[iColumn];
1189:                return precision;
1190:            }
1191:
1192:            /**
1193:              To get a column precision of a specified column in a <CODE>ByteArrayParser</CODE>.
1194:            
1195:              <P><PRE>
1196:              Method: public int getPrecision(String sProperty)
1197:              Visibility: Public
1198:              Purpose:	To return the precision of a specified column.
1199:              </PRE></P>
1200:              @param sProperty			 	Specifies the property/Column that you wish to get the value of.
1201:              @return 					Returns the precision of the specified column.
1202:              @exception	Exception		<P><PRE>Throws one possible Exception under this Circumstance.
1203:            								Circumstance: If the property/column specified does not exist.
1204:            								</PRE></P>
1205:             */
1206:
1207:            public int getPrecision(String sProperty) throws ParserException {
1208:                int iColumn = -1;
1209:                //	  Debugger.println("Property is "+sProperty);
1210:                for (int i = 0; i < getColumnCount(); i++) {
1211:                    //	    Debugger.println(i+" Column Name is "+getColumnName(i));
1212:                    if (getColumnName(i).equals(sProperty)) {
1213:                        iColumn = i;
1214:                        break;
1215:                    }
1216:                }
1217:                if (iColumn == -1)
1218:                    throw new ParserException("Invalid Column Name "
1219:                            + sProperty);
1220:                int precision = getPrecision(iColumn);
1221:                return precision;
1222:            }
1223:
1224:            /**
1225:              To get the bytes of a column as a string from a specified column in a  <CODE>ByteArrayParser</CODE>.
1226:            
1227:              <P><PRE>
1228:              Method: public String getValue(String sProperty) throws Exception
1229:              Visibility: Public
1230:              Purpose:	To get the value of a column from a parsed object.
1231:              </PRE></P>
1232:              @param sProperty			 	Specifies the property/Column that you wish to get the value of.
1233:              @return 						Returns the value of the specified column.
1234:              @exception	Exception		<P><PRE>Throws one possible Exception under this Circumstance.
1235:            								Circumstance: If the property/column specified does not exist.
1236:            								</PRE></P>
1237:             */
1238:
1239:            public String getValue(String sProperty) throws ParserException {
1240:                int iColumn = -1;
1241:                //	  Debugger.println("Property is "+sProperty);
1242:                for (int i = 0; i < getColumnCount(); i++) {
1243:                    //	    Debugger.println(i+" Column Name is "+getColumnName(i));
1244:                    if (getColumnName(i).equals(sProperty)) {
1245:                        iColumn = i;
1246:                        break;
1247:                    }
1248:                }
1249:                if (iColumn == -1)
1250:                    throw new ParserException("Invalid Column Name "
1251:                            + sProperty);
1252:                //	  Debugger.println("Property is "+sProperty);
1253:                //	  Debugger.println("OFFSET is "+OFFSET);
1254:                //	  Debugger.println("MULTIROW is "+MULTIROW);
1255:                //	  Debugger.println("ROWLENGTH is "+ROWLENGTH);
1256:                //	  Debugger.println("START INDEX is "+DATASTARTINDEXES[iColumn]);
1257:                //	  Debugger.println("Length is "+DATALENGTHS[iColumn]);
1258:                String sData;
1259:                if (MULTIROW)
1260:                    sData = new String(baOutputMessage, CURRENTROWOFFSET
1261:                            + DATASTARTINDEXES[iColumn], DATALENGTHS[iColumn]);
1262:                else
1263:                    sData = new String(baOutputMessage,
1264:                            DATASTARTINDEXES[iColumn], DATALENGTHS[iColumn]);
1265:                return sData;
1266:            }
1267:
1268:            /**
1269:              To set the bytes of a column from a string for a specified column in a  <CODE>ByteArrayParser</CODE>.
1270:            
1271:              <P><PRE>
1272:              Method: public void setValue(String sProperty,String sValue) throws Exception
1273:              Visibility: Public
1274:              Purpose:	To set the value of a column in a parsed object.
1275:              </PRE></P>
1276:              @param sProperty			 	Specifies the property/Column that you wish to set the value of.
1277:              @param sValue				 	Specifies the value you want to set to a particular property/Column.
1278:              @exception	Exception		<P><PRE>Throws two possible Exception under these Circumstances.
1279:            								Circumstance 1: If the property/column specified does not exist.
1280:            								Circumstance 2: If the length of the values being passed is not equal to the required column length.
1281:            								</PRE></P>
1282:             */
1283:            public void setValue(String sProperty, String sValue)
1284:                    throws ParserException {
1285:                int iColumn = -1;
1286:                for (int i = 0; i < getColumnCount(); i++) {
1287:                    if (getColumnName(i).equals(sProperty)) {
1288:                        iColumn = i;
1289:                        break;
1290:                    }
1291:                }
1292:                if (iColumn == -1)
1293:                    throw new ParserException("Invalid Column Name "
1294:                            + sProperty);
1295:                if (sValue.length() != DATALENGTHS[iColumn])
1296:                    throw new ParserException("Value " + sValue
1297:                            + " Passed must be " + DATALENGTHS[iColumn]
1298:                            + " Characters in length.");
1299:                if (MULTIROW)
1300:                    fillMessage(sValue, CURRENTROWOFFSET
1301:                            + DATASTARTINDEXES[iColumn], OFFSET - ROWLENGTH
1302:                            + DATASTARTINDEXES[iColumn] + DATALENGTHS[iColumn]);
1303:                else
1304:                    fillMessage(sValue, DATASTARTINDEXES[iColumn],
1305:                            DATASTARTINDEXES[iColumn] + DATALENGTHS[iColumn]);
1306:            }
1307:
1308:            public int getLength(String sProperty) throws ParserException {
1309:                int iColumn = -1;
1310:                for (int i = 0; i < getColumnCount(); i++) {
1311:                    if (getColumnName(i).equals(sProperty)) {
1312:                        iColumn = i;
1313:                        break;
1314:                    }
1315:                }
1316:                if (iColumn == -1)
1317:                    throw new ParserException("Invalid Column Name "
1318:                            + sProperty);
1319:                return DATALENGTHS[iColumn];
1320:            }
1321:
1322:            /**
1323:              To get an object representation of a column from a specified column in a  <CODE>ByteArrayParser</CODE>.
1324:            
1325:              <P><PRE>
1326:              Method: public Object getObject(String sProperty) throws Exception
1327:              Visibility: Public
1328:              Purpose:	To get the object value of a column from a parsed object.
1329:              </PRE></P>
1330:              @param sProperty			 	Specifies the property/Column that you wish to get the value of.
1331:              @return 						Returns the value of the specified column as an Object.
1332:              @exception	Exception		<P><PRE>Throws two possible Exception under this Circumstance.
1333:            								Circumstance: If doParse method was never called.
1334:            								Circumstance: If the property/column specified does not exist.
1335:            								</PRE></P>
1336:             */
1337:
1338:            public Object getObject(String sProperty) throws ParserException {
1339:                int iColumn = -1;
1340:                for (int i = 0; i < getColumnCount(); i++) {
1341:                    if (getColumnName(i).equals(sProperty)) {
1342:                        iColumn = i;
1343:                        break;
1344:                    }
1345:                }
1346:                if (iColumn == -1)
1347:                    throw new ParserException("Invalid Column Name "
1348:                            + sProperty);
1349:                if (_data.elementAt(iColumn) == null)
1350:                    _data.setElementAt(getParsedObject(iColumn,
1351:                            CURRENTROWOFFSET), iColumn);
1352:                return _data.elementAt(iColumn);
1353:            }
1354:
1355:            /**
1356:              To get an object representation of a column from a specified column in a  <CODE>ByteArrayParser</CODE>.
1357:
1358:              <P><PRE>
1359:              Method: public Object getObject(int iColumn) throws Exception
1360:              Visibility: Public
1361:              Purpose:	To get the object value of a column from a parsed object.
1362:              </PRE></P>
1363:              @param iColumn			 	Specifies the index of the that you wish to get the value of.
1364:              @return 						Returns the value of the specified column as an Object.
1365:              @exception	Exception		<P><PRE>Throws two possible Exception under this Circumstance.
1366:            								Circumstance: If doParse method was never called.
1367:            								Circumstance: If the column index specified is out of bounds.
1368:            								</PRE></P>
1369:             */
1370:            public Object getObject(int iColumn) throws ParserException {
1371:                if (_data.elementAt(iColumn) == null)
1372:                    _data.setElementAt(getParsedObject(iColumn,
1373:                            CURRENTROWOFFSET), iColumn);
1374:                return _data.elementAt(iColumn);
1375:            }
1376:
1377:            /**
1378:              To set a column with an object for a specified column in a  <CODE>ByteArrayParser</CODE>.
1379:            
1380:              <P><PRE>
1381:              Method: public void setObject(String sProperty,Object oValue) throws Exception
1382:              Visibility: Public
1383:              Purpose:	To set the value of a column in a parsed object.
1384:              </PRE></P>
1385:              @param sProperty			 	Specifies the property/Column that you wish to set the value of.
1386:              @oValue					 	Specifies the value you want to set to a particular property/Column.
1387:              @exception	Exception		<P><PRE>Throws five possible Exception under these Circumstances.
1388:            								Circumstance 1: If the property/column specified does not exist.
1389:            								Circumstance 2: If the length of the values being passed is not equal to the required column length for String objects.
1390:            								Circumstance 3: If doParse has not been called.
1391:            								Circumstance 4: If the object passed is null.
1392:            								Circumstance 5: If the value of an Integer or Float type is not within its min/max range determined by its length.
1393:            								</PRE></P>
1394:             */
1395:            public void setObject(String sProperty, Object oValue)
1396:                    throws ParserException {
1397:                if (oValue == null)
1398:                    throw new ParserException("Not allowed to set " + sProperty
1399:                            + " to null.");
1400:                int iColumn = -1;
1401:                for (int i = 0; i < getColumnCount(); i++) {
1402:                    if (getColumnName(i).equals(sProperty)) {
1403:                        iColumn = i;
1404:                        break;
1405:                    }
1406:                }
1407:                if (iColumn == -1)
1408:                    throw new ParserException("Invalid Column Name "
1409:                            + sProperty);
1410:                int iColumnType = DATATYPES[iColumn];
1411:                String sValueAsBytes = "";
1412:                switch (iColumnType) {
1413:                case TYPE_DATE_YYMM:
1414:                case TYPE_DATE_MMYY:
1415:                case TYPE_STRING: {
1416:                    if (!oValue.getClass().getName().equals("java.lang.String"))
1417:                        throw new ParserException(
1418:                                "Object passed must be a java.lang.String for Column "
1419:                                        + sProperty + ".");
1420:                    if (((String) oValue).length() != DATALENGTHS[iColumn])
1421:                        throw new ParserException("Value " + (String) oValue
1422:                                + " Passed must be " + DATALENGTHS[iColumn]
1423:                                + " Characters in length for Column "
1424:                                + sProperty + ".");
1425:                    _data.setElementAt(oValue, iColumn);
1426:                    setValue(sProperty, (String) oValue);
1427:                    break;
1428:                }
1429:                case TYPE_CUSTOM: {
1430:                    if ((((CustomType) DATACUSTOMTYPES[iColumn])
1431:                            .toString(oValue)).length() != DATALENGTHS[iColumn])
1432:                        throw new ParserException("Value "
1433:                                + ((CustomType) DATACUSTOMTYPES[iColumn])
1434:                                        .toString(oValue) + " Passed must be "
1435:                                + DATALENGTHS[iColumn]
1436:                                + " Characters in length for Column "
1437:                                + sProperty + " .");
1438:                    _data.setElementAt(oValue, iColumn);
1439:                    setValue(sProperty, ((CustomType) DATACUSTOMTYPES[iColumn])
1440:                            .toString(oValue));
1441:                    break;
1442:                }
1443:                case TYPE_CHAR: {
1444:                    if (!oValue.getClass().getName().equals(
1445:                            "java.lang.Character"))
1446:                        throw new ParserException(
1447:                                "Object passed must be a java.lang.Character for Column "
1448:                                        + sProperty + ".");
1449:                    String sChar = oValue.toString();
1450:                    if (DATALENGTHS[iColumn] > 1)
1451:                        sChar = padString(sChar, DATALENGTHS[iColumn], ' ');
1452:                    _data.setElementAt(oValue, iColumn);
1453:                    setValue(sProperty, sChar);
1454:                    break;
1455:                }
1456:                case TYPE_INT: {
1457:                    if (!oValue.getClass().getName()
1458:                            .equals("java.lang.Integer"))
1459:                        throw new ParserException(
1460:                                "Object passed must be a java.lang.Integer for Column "
1461:                                        + sProperty + ".");
1462:                    boolean bSigned = DATASIGNED[iColumn];
1463:                    int iLength = DATALENGTHS[iColumn];
1464:                    int iMax = 0;
1465:                    int iMin = 0;
1466:                    double dMax = Math.pow((double) 10, (double) iLength);
1467:                    iMax = ((int) dMax) - 1;
1468:                    String sValue = "" + ((Integer) oValue).intValue();
1469:                    if (bSigned) {
1470:                        iMin = (-iMax);
1471:                        String sUnsignedData = "";
1472:                        boolean bNegative = false;
1473:                        if (sValue.length() >= 2) {
1474:                            sUnsignedData = sValue.substring(0,
1475:                                    sValue.length() - 1);
1476:                            if (sUnsignedData.charAt(0) == '-') {
1477:                                sUnsignedData = sUnsignedData.substring(1);
1478:                                bNegative = true;
1479:                            }
1480:                        }
1481:                        char cSignedChar = sValue.charAt(sValue.length() - 1);
1482:                        if (!bNegative) {
1483:                            switch (cSignedChar) {
1484:                            case '0':
1485:                                sValueAsBytes = sUnsignedData + '{';
1486:                                break;
1487:                            case '1':
1488:                                sValueAsBytes = sUnsignedData + 'A';
1489:                                break;
1490:                            case '2':
1491:                                sValueAsBytes = sUnsignedData + 'B';
1492:                                break;
1493:                            case '3':
1494:                                sValueAsBytes = sUnsignedData + 'C';
1495:                                break;
1496:                            case '4':
1497:                                sValueAsBytes = sUnsignedData + 'D';
1498:                                break;
1499:                            case '5':
1500:                                sValueAsBytes = sUnsignedData + 'E';
1501:                                break;
1502:                            case '6':
1503:                                sValueAsBytes = sUnsignedData + 'F';
1504:                                break;
1505:                            case '7':
1506:                                sValueAsBytes = sUnsignedData + 'G';
1507:                                break;
1508:                            case '8':
1509:                                sValueAsBytes = sUnsignedData + 'H';
1510:                                break;
1511:                            case '9':
1512:                                sValueAsBytes = sUnsignedData + 'I';
1513:                                break;
1514:                            }
1515:                        } else {
1516:                            switch (cSignedChar) {
1517:                            case '0':
1518:                                sValueAsBytes = sUnsignedData + '}';
1519:                                break;
1520:                            case '1':
1521:                                sValueAsBytes = sUnsignedData + 'J';
1522:                                break;
1523:                            case '2':
1524:                                sValueAsBytes = sUnsignedData + 'K';
1525:                                break;
1526:                            case '3':
1527:                                sValueAsBytes = sUnsignedData + 'L';
1528:                                break;
1529:                            case '4':
1530:                                sValueAsBytes = sUnsignedData + 'M';
1531:                                break;
1532:                            case '5':
1533:                                sValueAsBytes = sUnsignedData + 'N';
1534:                                break;
1535:                            case '6':
1536:                                sValueAsBytes = sUnsignedData + 'O';
1537:                                break;
1538:                            case '7':
1539:                                sValueAsBytes = sUnsignedData + 'P';
1540:                                break;
1541:                            case '8':
1542:                                sValueAsBytes = sUnsignedData + 'Q';
1543:                                break;
1544:                            case '9':
1545:                                sValueAsBytes = sUnsignedData + 'R';
1546:                                break;
1547:                            }
1548:                        }
1549:                    } else
1550:                        sValueAsBytes = sValue;
1551:                    if (((Integer) oValue).intValue() < iMin
1552:                            || ((Integer) oValue).intValue() > iMax)
1553:                        throw new ParserException("Object " + oValue
1554:                                + " passed must have a value between " + iMin
1555:                                + " & " + iMax + " for Column " + sProperty
1556:                                + ".");
1557:                    _data.setElementAt(oValue, iColumn);
1558:                    setValue(sProperty, padStringInFront(sValueAsBytes,
1559:                            iLength, '0'));
1560:                    break;
1561:                }
1562:                case TYPE_FLOAT: {
1563:                    if (!oValue.getClass().getName().equals("java.lang.Float"))
1564:                        throw new ParserException(
1565:                                "Object passed must be a java.lang.Float for Column "
1566:                                        + sProperty + ".");
1567:                    boolean bSigned = DATASIGNED[iColumn];
1568:                    int iPrecision = DATAPRECISIONS[iColumn];
1569:                    int iLength = DATALENGTHS[iColumn];
1570:                    float fMax = 0;
1571:                    float fMin = 0;
1572:                    double dMax = Math.pow((double) 10,
1573:                            (double) (iLength - iPrecision));
1574:                    double dPrecisionMax = Math.pow((double) 10,
1575:                            (double) (iPrecision));
1576:                    fMax = (float) ((((int) dMax) - 1))
1577:                            + ((float) ((((int) dPrecisionMax) - 1)) / (float) dPrecisionMax);
1578:                    String sRealFormat = padString("", iLength - iPrecision,
1579:                            '#');
1580:                    String sDecimalFormat = padString("", iPrecision, '0');
1581:                    DecimalFormat df = new DecimalFormat(sRealFormat + "."
1582:                            + sDecimalFormat);
1583:                    String sValue = df.format(((Float) oValue).floatValue());
1584:                    int iDotIndex = sValue.indexOf('.');
1585:                    if (iDotIndex > 0 && iDotIndex <= sValue.length() - 2)
1586:                        sValue = sValue.substring(0, iDotIndex)
1587:                                + sValue.substring(iDotIndex + 1);
1588:                    else if (iDotIndex == 0 && sValue.length() > 1)
1589:                        sValue = sValue.substring(1);
1590:                    else if (iDotIndex == sValue.length() - 1)
1591:                        sValue = sValue.substring(0, sValue.length() - 1);
1592:                    if (bSigned) {
1593:                        fMin = (-fMax);
1594:                        String sUnsignedData = "";
1595:                        boolean bNegative = false;
1596:                        if (sValue.length() >= 2) {
1597:                            sUnsignedData = sValue.substring(0,
1598:                                    sValue.length() - 1);
1599:                            if (sUnsignedData.charAt(0) == '-') {
1600:                                sUnsignedData = sUnsignedData.substring(1);
1601:                                bNegative = true;
1602:                            }
1603:                        }
1604:                        char cSignedChar = sValue.charAt(sValue.length() - 1);
1605:                        if (!bNegative) {
1606:                            switch (cSignedChar) {
1607:                            case '0':
1608:                                sValueAsBytes = sUnsignedData + '{';
1609:                                break;
1610:                            case '1':
1611:                                sValueAsBytes = sUnsignedData + 'A';
1612:                                break;
1613:                            case '2':
1614:                                sValueAsBytes = sUnsignedData + 'B';
1615:                                break;
1616:                            case '3':
1617:                                sValueAsBytes = sUnsignedData + 'C';
1618:                                break;
1619:                            case '4':
1620:                                sValueAsBytes = sUnsignedData + 'D';
1621:                                break;
1622:                            case '5':
1623:                                sValueAsBytes = sUnsignedData + 'E';
1624:                                break;
1625:                            case '6':
1626:                                sValueAsBytes = sUnsignedData + 'F';
1627:                                break;
1628:                            case '7':
1629:                                sValueAsBytes = sUnsignedData + 'G';
1630:                                break;
1631:                            case '8':
1632:                                sValueAsBytes = sUnsignedData + 'H';
1633:                                break;
1634:                            case '9':
1635:                                sValueAsBytes = sUnsignedData + 'I';
1636:                                break;
1637:                            }
1638:                        } else {
1639:                            switch (cSignedChar) {
1640:                            case '0':
1641:                                sValueAsBytes = sUnsignedData + '}';
1642:                                break;
1643:                            case '1':
1644:                                sValueAsBytes = sUnsignedData + 'J';
1645:                                break;
1646:                            case '2':
1647:                                sValueAsBytes = sUnsignedData + 'K';
1648:                                break;
1649:                            case '3':
1650:                                sValueAsBytes = sUnsignedData + 'L';
1651:                                break;
1652:                            case '4':
1653:                                sValueAsBytes = sUnsignedData + 'M';
1654:                                break;
1655:                            case '5':
1656:                                sValueAsBytes = sUnsignedData + 'N';
1657:                                break;
1658:                            case '6':
1659:                                sValueAsBytes = sUnsignedData + 'O';
1660:                                break;
1661:                            case '7':
1662:                                sValueAsBytes = sUnsignedData + 'P';
1663:                                break;
1664:                            case '8':
1665:                                sValueAsBytes = sUnsignedData + 'Q';
1666:                                break;
1667:                            case '9':
1668:                                sValueAsBytes = sUnsignedData + 'R';
1669:                                break;
1670:                            }
1671:                        }
1672:                    } else
1673:                        sValueAsBytes = sValue;
1674:                    if (((Float) oValue).floatValue() < fMin
1675:                            || ((Float) oValue).floatValue() > fMax)
1676:                        throw new ParserException("Object " + oValue
1677:                                + " passed must have a value between " + fMin
1678:                                + " & " + fMax + " for Column " + sProperty
1679:                                + ".");
1680:                    float fValue = ((int) (((Float) oValue).floatValue() * (int) dPrecisionMax))
1681:                            / (float) dPrecisionMax;
1682:                    _data.setElementAt(new Float(fValue), iColumn);
1683:                    setValue(sProperty, padStringInFront(sValueAsBytes,
1684:                            iLength, '0'));
1685:                    break;
1686:                }
1687:                case TYPE_DOUBLE: {
1688:                    if (!oValue.getClass().getName().equals("java.lang.Double"))
1689:                        throw new ParserException(
1690:                                "Object passed must be a java.lang.Double for Column "
1691:                                        + sProperty + ".");
1692:                    boolean bSigned = DATASIGNED[iColumn];
1693:                    int iPrecision = DATAPRECISIONS[iColumn];
1694:                    int iLength = DATALENGTHS[iColumn];
1695:                    double dMax = 0;
1696:                    double dMin = 0;
1697:                    double ddMax = Math.pow((double) 10,
1698:                            (double) (iLength - iPrecision));
1699:                    double dPrecisionMax = Math.pow((double) 10,
1700:                            (double) (iPrecision));
1701:                    dMax = (double) ((((long) ddMax) - 1))
1702:                            + ((double) ((((long) dPrecisionMax) - 1)) / (double) dPrecisionMax);
1703:                    String sRealFormat = padString("", iLength - iPrecision,
1704:                            '#');
1705:                    String sDecimalFormat = padString("", iPrecision, '0');
1706:                    DecimalFormat df = new DecimalFormat(sRealFormat + "."
1707:                            + sDecimalFormat);
1708:                    String sValue = df.format(((Double) oValue).doubleValue());
1709:                    int iDotIndex = sValue.indexOf('.');
1710:                    if (iDotIndex > 0 && iDotIndex <= sValue.length() - 2)
1711:                        sValue = sValue.substring(0, iDotIndex)
1712:                                + sValue.substring(iDotIndex + 1);
1713:                    else if (iDotIndex == 0 && sValue.length() > 1)
1714:                        sValue = sValue.substring(1);
1715:                    else if (iDotIndex == sValue.length() - 1)
1716:                        sValue = sValue.substring(0, sValue.length() - 1);
1717:                    if (bSigned) {
1718:                        dMin = (-dMax);
1719:                        String sUnsignedData = "";
1720:                        boolean bNegative = false;
1721:                        if (sValue.length() >= 2) {
1722:                            sUnsignedData = sValue.substring(0,
1723:                                    sValue.length() - 1);
1724:                            if (sUnsignedData.charAt(0) == '-') {
1725:                                sUnsignedData = sUnsignedData.substring(1);
1726:                                bNegative = true;
1727:                            }
1728:                        }
1729:                        char cSignedChar = sValue.charAt(sValue.length() - 1);
1730:                        if (!bNegative) {
1731:                            switch (cSignedChar) {
1732:                            case '0':
1733:                                sValueAsBytes = sUnsignedData + '{';
1734:                                break;
1735:                            case '1':
1736:                                sValueAsBytes = sUnsignedData + 'A';
1737:                                break;
1738:                            case '2':
1739:                                sValueAsBytes = sUnsignedData + 'B';
1740:                                break;
1741:                            case '3':
1742:                                sValueAsBytes = sUnsignedData + 'C';
1743:                                break;
1744:                            case '4':
1745:                                sValueAsBytes = sUnsignedData + 'D';
1746:                                break;
1747:                            case '5':
1748:                                sValueAsBytes = sUnsignedData + 'E';
1749:                                break;
1750:                            case '6':
1751:                                sValueAsBytes = sUnsignedData + 'F';
1752:                                break;
1753:                            case '7':
1754:                                sValueAsBytes = sUnsignedData + 'G';
1755:                                break;
1756:                            case '8':
1757:                                sValueAsBytes = sUnsignedData + 'H';
1758:                                break;
1759:                            case '9':
1760:                                sValueAsBytes = sUnsignedData + 'I';
1761:                                break;
1762:                            }
1763:                        } else {
1764:                            switch (cSignedChar) {
1765:                            case '0':
1766:                                sValueAsBytes = sUnsignedData + '}';
1767:                                break;
1768:                            case '1':
1769:                                sValueAsBytes = sUnsignedData + 'J';
1770:                                break;
1771:                            case '2':
1772:                                sValueAsBytes = sUnsignedData + 'K';
1773:                                break;
1774:                            case '3':
1775:                                sValueAsBytes = sUnsignedData + 'L';
1776:                                break;
1777:                            case '4':
1778:                                sValueAsBytes = sUnsignedData + 'M';
1779:                                break;
1780:                            case '5':
1781:                                sValueAsBytes = sUnsignedData + 'N';
1782:                                break;
1783:                            case '6':
1784:                                sValueAsBytes = sUnsignedData + 'O';
1785:                                break;
1786:                            case '7':
1787:                                sValueAsBytes = sUnsignedData + 'P';
1788:                                break;
1789:                            case '8':
1790:                                sValueAsBytes = sUnsignedData + 'Q';
1791:                                break;
1792:                            case '9':
1793:                                sValueAsBytes = sUnsignedData + 'R';
1794:                                break;
1795:                            }
1796:                        }
1797:                    } else
1798:                        sValueAsBytes = sValue;
1799:                    if (((Double) oValue).doubleValue() < dMin
1800:                            || ((Double) oValue).doubleValue() > dMax)
1801:                        throw new ParserException("Object " + oValue
1802:                                + " passed must have a value between " + dMin
1803:                                + " & " + dMax + "for Column " + sProperty
1804:                                + ".");
1805:                    double dValue = ((long) (((Double) oValue).doubleValue() * (long) dPrecisionMax))
1806:                            / (double) dPrecisionMax;
1807:                    _data.setElementAt(new Double(dValue), iColumn);
1808:                    setValue(sProperty, padStringInFront(sValueAsBytes,
1809:                            iLength, '0'));
1810:                    break;
1811:                }
1812:                case TYPE_DATE_CCYYMMDD: {
1813:                    if (!oValue.getClass().getName().equals("java.sql.Date"))
1814:                        throw new ParserException(
1815:                                "Object passed must be a java.sql.Date for Column "
1816:                                        + sProperty + ".");
1817:                    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
1818:                    MessageLog.writeDebugMessage(
1819:                            "oValue for setObject for property " + sProperty
1820:                                    + "=" + oValue, this );
1821:
1822:                    String sDate = sdf.format((java.util.Date) oValue);
1823:                    MessageLog.writeDebugMessage(
1824:                            "Translated oValue for setObject for property "
1825:                                    + sProperty + "=" + sDate, this );
1826:                    _data.setElementAt(oValue, iColumn);
1827:                    setValue(sProperty, sDate);
1828:                    break;
1829:                }
1830:                }
1831:            }
1832:
1833:            /**
1834:              To clear out all the stored parsed values in a <CODE>ByteArrayParser</CODE>, so that it can be parsed again.
1835:
1836:              <P><PRE>
1837:              Method: public void reset()
1838:              Visibility: Public
1839:              Purpose:	To clear the stored parsed values such that parsing will reoccur.
1840:              </PRE></P>
1841:             */
1842:            public void reset() {
1843:                for (int i = 0; i < _data.size(); i++)
1844:                    _data.setElementAt(null, i);
1845:                CURRENTROWOFFSET = 0;
1846:                OFFSET = 0;
1847:            }
1848:
1849:            /**
1850:              To get the byte array of a <CODE>ByteArrayParser</CODE>.
1851:            
1852:              <P><PRE>
1853:              Method: public byte[] getMessage()
1854:              Visibility: Public
1855:              Purpose:	To get the byte[] message of a parsed object.
1856:              </PRE></P>
1857:              @return 		Returns the byte[] of the message.
1858:             */
1859:            public byte[] getMessage() {
1860:                return baOutputMessage;
1861:            }
1862:
1863:            /**
1864:              A static function to pad to the end of a string.
1865:            
1866:              <P><PRE>
1867:              Method: public final static String padString(String sPassed,int iPadLength,char cPadChar)
1868:              Visibility: Public
1869:              Purpose:	To pad a String with a specified character.
1870:              </PRE></P>
1871:              @param sPassed			 	Specifies the String to be Padded at End.
1872:              @param iPadLength			 	Specifies the final length of the padded string.
1873:              @param char cPadChar			Specifies the character to pad string with.
1874:              @return 						Returns the padded string.
1875:             */
1876:
1877:            public final static String padString(String sPassed,
1878:                    int iPadLength, char cPadChar) {
1879:                String sReturn = sPassed;
1880:                if (sReturn.length() < iPadLength) {
1881:                    int iPadding = iPadLength - sReturn.length();
1882:                    for (int i = 0; i < iPadding; i++)
1883:                        sReturn = sReturn + cPadChar;
1884:                }
1885:                return sReturn;
1886:            }
1887:
1888:            /**
1889:              A static function to pad to the beginning of a string.
1890:            
1891:              <P><PRE>
1892:              Method: public final static String padStringInFront(String sPassed,int iPadLength,char cPadChar)
1893:              Visibility: Public
1894:              Purpose:	To pad a String with a specified character.
1895:              </PRE></P>
1896:              @param sPassed			 	Specifies the String to be Padded in front.
1897:              @param iPadLength			 	Specifies the final length of the padded string.
1898:              @param char cPadChar			Specifies the character to pad string with.
1899:              @return 						Returns the padded string.
1900:             */
1901:            public final static String padStringInFront(String sPassed,
1902:                    int iPadLength, char cPadChar) {
1903:                String sReturn = sPassed;
1904:                if (sReturn.length() < iPadLength) {
1905:                    int iPadding = iPadLength - sReturn.length();
1906:                    for (int i = 0; i < iPadding; i++)
1907:                        sReturn = cPadChar + sReturn;
1908:                }
1909:                return sReturn;
1910:            }
1911:
1912:            /**
1913:              To fill the byte array of a <CODE>ByteArrayParser</CODE> at specified locations.
1914:            
1915:              <P><PRE>
1916:              Method: private void fillMessage(String sData,int iStartIndex,int iEndIndex)
1917:              Visibility: Private
1918:              Purpose:	To place data into the message block in the proper location.
1919:              </PRE></P>
1920:              @param sData			 	Specifies data to be placed into the message byte array.
1921:              @param iStartIndex	 	Specifies the starting index of where to place the data.
1922:              @param iEndIndex			Specifies the ending index of where to place the data.
1923:             */
1924:            private void fillMessage(String sData, int iStartIndex,
1925:                    int iEndIndex) {
1926:                byte[] baInData = sData.getBytes();
1927:                for (int j = 0, i = iStartIndex; i < iEndIndex; i++, j++) {
1928:                    baOutputMessage[i] = baInData[j];
1929:                }
1930:            }
1931:
1932:            /**
1933:              A function to get the column index of a specified column in ByteArrayParser.
1934:
1935:              <P><PRE>
1936:              Method: public int getColumnIndex(String sProperty) throws ParserException
1937:              Visibility: Public
1938:              Purpose:	To get the column index of the specified column.
1939:              </PRE></P>
1940:              @param sProperty			 	Specifies the column to get the index of.
1941:              @exception	Exception		<P><PRE>Throws an Exception under this Circumstance.
1942:                                           Circumstance: If the column specified does not exist.
1943:                                           </PRE></P>
1944:              @return 						Returns the index of the specified column.
1945:             */
1946:            public int getColumnIndex(String sProperty) throws ParserException {
1947:                int iColumn = -1;
1948:                for (int i = 0; i < getColumnCount(); i++) {
1949:                    if (getColumnName(i) != null) {
1950:                        if (getColumnName(i).equals(sProperty)) {
1951:                            iColumn = i;
1952:                            break;
1953:                        }
1954:                    } else
1955:                        break;
1956:                }
1957:                if (iColumn == -1)
1958:                    throw new ParserException("Invalid Column Name "
1959:                            + sProperty);
1960:
1961:                return iColumn;
1962:            }
1963:
1964:            /**
1965:              A function to get the start index of a specified column in ByteArrayParser.
1966:
1967:              <P><PRE>
1968:              Method: public int getColumnStartPosition(String sProperty) throws ParserException
1969:              Visibility: Public
1970:              Purpose:	To get the start index of the specified column.
1971:              </PRE></P>
1972:              @param sProperty			 	Specifies the column to get the start index of.
1973:              @exception	Exception		<P><PRE>Throws an Exception under this Circumstance.
1974:                                           Circumstance: If the column specified does not exist.
1975:                                           </PRE></P>
1976:              @return 						Returns the index of the specified column.
1977:             */
1978:            public int getColumnStartPosition(String sProperty)
1979:                    throws ParserException {
1980:                return DATASTARTINDEXES[getColumnIndex(sProperty)];
1981:            }
1982:
1983:            /**
1984:              A function to get the difference in bytes between two columns in ByteArrayParser.
1985:
1986:              <P><PRE>
1987:              Method: public int getColumnsDifference(String sPropertyBegin,String sPropertyEnd) throws ParserException
1988:              Visibility: Private
1989:              Purpose:	To get the difference in bytes between two columns.
1990:              </PRE></P>
1991:              @param sPropertyBegin			Specifies the Begin Column to find the difference between.
1992:              @param sPropertyEnd			Specifies the End Column to find the difference between.
1993:              @exception	Exception		<P><PRE>Throws an Exception under this Circumstance.
1994:                                           Circumstance: If either column specified does not exist.
1995:                                           </PRE></P>
1996:              @return 						Returns the difference in bytes between two columns in the ByteArrayParser.
1997:             */
1998:            private int getColumnsDifference(String sPropertyBegin,
1999:                    String sPropertyEnd) throws ParserException {
2000:
2001:                int startPos = getColumnStartPosition(sPropertyBegin);
2002:                int endPos = getColumnStartPosition(sPropertyEnd)
2003:                        + DATALENGTHS[getColumnIndex(sPropertyEnd)];
2004:                return endPos - startPos;
2005:            }
2006:
2007:            /**
2008:              To get the next index that will be used for a column in a <CODE>ByteArrayParser</CODE>.
2009:
2010:              <P><PRE>
2011:              Method: public int getNextIndex()
2012:              Visibility: Private
2013:              Purpose:	To get the next index of a column being added to ByteArrayParser.
2014:              </PRE></P>
2015:              @return 		Returns the next index to be used by added column.
2016:             */
2017:            private int getNextIndex() {
2018:                return STARTFIELD;
2019:            }
2020:
2021:            /**
2022:              To add a redefined column definition to a <CODE>ByteArrayParser</CODE>.
2023:
2024:              <P><PRE>
2025:              Method: public void addRedefinedColumnDefinition(String sRedefineName,int iType,int iPrecision,String sStartColumnName,String sEndColumnName,boolean bSigned) throws ArrayIndexOutOfBoundsException,ParserException
2026:              Visibility: Public
2027:              Purpose:	To specify a redefined column definition to be in used parsing the data
2028:            			contained in message.
2029:              </PRE></P>
2030:              @param sRedefineName		 	Specifies Name for the redefined column.
2031:              @param iType					Specifies the Format Type of Column. Valid values range 1-7. Public Constants exist for these values.
2032:              @param iPrecision				Specifies the precison of the Float date.
2033:              @param sStartColumnName		Specifies the start column of the redefined field.
2034:              @param sEndColumnName		    Specifies the end column of the redefined field.
2035:              @param bSigned				Indicates the Column data is signed.
2036:              @exception	ArrayIndexOutOfBoundsException	<P><PRE>Throws Exception under this Circumstance.
2037:            												Circumstance 1: If this new column is greater than specified number of Columns.
2038:            												</PRE></P>
2039:              @exception	ParserException	<P><PRE>Throw Exception under this Circumstance.
2040:            								Circumstance 1: If the Specified Start & End Columns do not exist.
2041:            								</PRE></P>
2042:             */
2043:            public void addRedefinedColumnDefinition(String sRedefineName,
2044:                    int iType, int iPrecision, String sStartColumnName,
2045:                    String sEndColumnName, boolean bSigned)
2046:                    throws ArrayIndexOutOfBoundsException, ParserException {
2047:                int iIndex = getNextIndex();
2048:                DATAREDEFINED[iIndex] = true;
2049:                addColumnDefinition(iIndex, sRedefineName, iType, iPrecision,
2050:                        getColumnStartPosition(sStartColumnName),
2051:                        getColumnsDifference(sStartColumnName, sEndColumnName),
2052:                        bSigned);
2053:            }
2054:
2055:            /**
2056:              To add a redefined column definition to a <CODE>ByteArrayParser</CODE>.
2057:
2058:              <P><PRE>
2059:              Method: public void addRedefinedColumnDefinition(String sRedefineName,int iType,String sStartColumnName,String sEndColumnName,boolean bSigned) throws ArrayIndexOutOfBoundsException,ParserException
2060:              Visibility: Public
2061:              Purpose:	To specify a redefined column definition to be in used parsing the data
2062:            			contained in message.
2063:              </PRE></P>
2064:              @param sRedefineName		 	Specifies Name for the redefined column.
2065:              @param iType					Specifies the Format Type of Column. Valid values range 1-7. Public Constants exist for these values.
2066:              @param sStartColumnName		Specifies the start column of the redefined field.
2067:              @param sEndColumnName		    Specifies the end column of the redefined field.
2068:              @param bSigned				Indicates the Column data is signed.
2069:              @exception	ArrayIndexOutOfBoundsException	<P><PRE>Throws Exception under this Circumstance.
2070:            												Circumstance 1: If this new column is greater than specified number of Columns.
2071:            												</PRE></P>
2072:              @exception	ParserException	<P><PRE>Throw Exception under this Circumstance.
2073:            								Circumstance 1: If the Specified Start & End Columns do not exist.
2074:            								</PRE></P>
2075:             */
2076:            public void addRedefinedColumnDefinition(String sRedefineName,
2077:                    int iType, String sStartColumnName, String sEndColumnName,
2078:                    boolean bSigned) throws ArrayIndexOutOfBoundsException,
2079:                    ParserException {
2080:                int iIndex = getNextIndex();
2081:                DATAREDEFINED[iIndex] = true;
2082:
2083:                addColumnDefinition(iIndex, sRedefineName, iType,
2084:                        getColumnStartPosition(sStartColumnName),
2085:                        getColumnsDifference(sStartColumnName, sEndColumnName),
2086:                        bSigned);
2087:            }
2088:
2089:            /**
2090:              To add a redefined column definition to a <CODE>ByteArrayParser</CODE>.
2091:
2092:              <P><PRE>
2093:              Method: public void addRedefinedColumnDefinition(String sRedefineName,int iType,int iPrecision,String sStartColumnName,String sEndColumnName,boolean bSigned) throws ArrayIndexOutOfBoundsException,ParserException
2094:              Visibility: Public
2095:              Purpose:	To specify a redefined column definition to be in used parsing the data
2096:            			contained in message.
2097:              </PRE></P>
2098:              @param sRedefineName		 	Specifies Name for the redefined column.
2099:              @param cType					Specifies the Custom Type of Column.
2100:              @param sStartColumnName		Specifies the start column of the redefined field.
2101:              @param sEndColumnName		    Specifies the end column of the redefined field.
2102:              @param bSigned				Indicates the Column data is signed.
2103:              @exception	ArrayIndexOutOfBoundsException	<P><PRE>Throws Exception under this Circumstance.
2104:            												Circumstance 1: If this new column is greater than specified number of Columns.
2105:            												</PRE></P>
2106:              @exception	ParserException	<P><PRE>Throw Exception under this Circumstance.
2107:            								Circumstance 1: If the Specified Start & End Columns do not exist.
2108:            								</PRE></P>
2109:             */
2110:            public void addRedefinedColumnDefinition(String sRedefineName,
2111:                    CustomType cType, String sStartColumnName,
2112:                    String sEndColumnName, boolean bSigned)
2113:                    throws ArrayIndexOutOfBoundsException, ParserException {
2114:
2115:                int iIndex = getNextIndex();
2116:                DATAREDEFINED[iIndex] = true;
2117:                addColumnDefinition(iIndex, sRedefineName, cType,
2118:                        getColumnStartPosition(sStartColumnName),
2119:                        getColumnsDifference(sStartColumnName, sEndColumnName),
2120:                        bSigned);
2121:            }
2122:
2123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.