private final byte[] encodePart(JsMsgPart jsPart) throws MessageEncodeFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "encodePart", jsPart);

    JMFMessage msg = (JMFMessage)jsPart.jmfPart;
    byte[] buffer = null;
    int length = 0;

    try {
        length = msg.getEncodedLength();
        buffer = msg.toByteArray(length);
    }
    catch (Exception e) {
      // Dump the message part, and whatever we've managed to encode so far.
      FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodePart", "jmo630", this,
          new Object[] {
            new Object[] { MfpConstants.DM_MESSAGE, msg, theMessage },
            new Object[] { MfpConstants.DM_BUFFER, buffer, Integer.valueOf(0), Integer.valueOf(length) }
          }
        );
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "encode failed: " + e);
      throw new MessageEncodeFailedException(e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "encodePart", Integer.valueOf(length));
    return buffer;

  }
private final byte [ ] encodePart ( JsMsgPart jsPart ) throws MessageEncodeFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodePart" , jsPart ) ; JMFMessage msg = ( JMFMessage ) jsPart . jmfPart ; byte [ ] buffer = null ; int length = 0 ; try { length = msg . getEncodedLength ( ) ; buffer = msg . toByteArray ( length ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodePart" , "jmo630" , this , new Object [ ] { new Object [ ] { MfpConstants . DM_MESSAGE , msg , theMessage } , new Object [ ] { MfpConstants . DM_BUFFER , buffer , Integer . valueOf ( 0 ) , Integer . valueOf ( length ) } } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "encode failed: " + e ) ; throw new MessageEncodeFailedException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "encodePart" , Integer . valueOf ( length ) ) ; return buffer ; }
Return a byte array containing the message part encoded for transmission.
Locking: The caller MUST have already synchronized on getPartLockArtefact(jsPart)
before calling this method.

@param jmfPart The JMF message part to be encoded.

@return a byte array containing the encoded message part.

@exception MessageEncodeFailedException is thrown if the message part failed to encode.