com.genesyslab.platform.commons.protocol
Class MessageParser
java.lang.Object
com.genesyslab.platform.commons.protocol.MessageParser
public class MessageParser
- extends java.lang.Object
This class can be used for manual extracting Message object from byte array.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MessageParser
public MessageParser(ProtocolFactory protocolFactory)
MessageParser
public MessageParser(ProtocolFactory protocolFactory,
java.lang.String stringAttributesEncoding)
getFactory
public ProtocolFactory getFactory()
parse
public Message parse(byte[] bytes,
int pos,
int len)
throws ProtocolException
- This method tries to extract Message object from the given byte array,
beginning from specified position. In some cases the length of the packed message (4 bytes)
can be included in byte array. Note that all parse methods do not expect length or
any other data in the buffer. Modify starting position and length accordingly to cut those
length or additional data off.
- Parameters:
bytes
- binary array containing representation of messagepos
- position where message (number of attributes byte) beginslen
- length of binary representation
- Returns:
- Parsed message
- Throws:
ProtocolException
- if message can't be parsed
parse
public Message parse(byte[] bytes)
throws ProtocolException
- This method tries to extract Message object from the given byte array.
In some cases the length of the packed message (4 bytes)
can be included in byte array. Note that all parse methods do not expect length or
any other data in the buffer.
- Parameters:
bytes
- binary array containing representation of message
- Returns:
- parsed message
- Throws:
ProtocolException
- if message can't be parsed
setErrorHandler
public void setErrorHandler(MessageParser.ErrorHandler errorHandler)
- Message parser can detect some errors which are not critical to message parsing.
One such example is unknown message attributes. Such errors can be reported to
ErrorHandler.
- Parameters:
errorHandler
- error handler to report non-critical errors
Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.