Custom Field Parsers

If none of the standard parsing strategies allow you to correctly parse data from the message buffer, use the example code in this topic to customize the field parser in a message definition.

If none of the standard parsing strategies allow you to correctly parse data from the message buffer, you can customize the field parser. To do so, you must provide a Java class that implements the com.sybase.jtf.parser.api.ICustomParserField interface. This interface is contained in the pgen.jar file, which is provided with the WorkSpace Message Designer.
// package declaration
package com.sybase.jtf.parser.api;

/**
 * The ICustomParserField interface provides an extension point in which 
 * clients can develop custom code to define a means of parsing a field 
 * that is not defined in the standard API.
 */
public interface ICustomParserField {

        /**
         * 
         * 
         * @param buffer The message buffer.
         * @param offset The offset into the buffer.
         * @param max   The maximum offset within the buffer.
         * @param result The result of the parse.
         * @param name  The name of the component.
         * 
         * @return The number of bytes consumed or -1 meaning failure.
         */
        public int parseField(byte[] buffer, int offset, int max, ParseResult result, String name);
}
Related tasks
Implementing a Custom Field Parser

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.