public int getMessageLength ( ) { // Message type, ticket # int messageLength = 1 + 4 ; // Identifier length prefix messageLength += 4 ; if ( this . identifierRegex != null ) { try { messageLength += this . identifierRegex . getBytes ( "UTF-16BE" ) . length ; } catch ( UnsupportedEncodingException e ) { log . error ( "Unable to encode String into UTF-16." ) ; e . printStackTrace ( ) ; } } // Number of query attributes length prefix messageLength += 4 ; // Add length prefix and String length for each attribute if ( this . attributeRegexes != null ) { for ( String attrib : this . attributeRegexes ) { messageLength += 4 ; try { messageLength += attrib . getBytes ( "UTF-16BE" ) . length ; } catch ( UnsupportedEncodingException e ) { log . error ( "Unable to encode String into uTF-16" ) ; e . printStackTrace ( ) ; } } } // Begin and end timestamps messageLength += 16 ; return messageLength ; }
Returns the length of the message in bytes excluding the message length prefix value .