private static void encodeBasicProperties(ByteArrayOutputStream baos, boolean isTopic, Map<String,Object> destProps) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "encodeBasicProperties", new Object[]{baos, isTopic, destProps});

    // Examine the basic property information. Note that this uses internal
    // knowledge of how the destination properties are stored.
    String dm   = (String) destProps.remove(JmsInternalConstants.DELIVERY_MODE);
    Integer pri = (Integer)destProps.remove(JmsInternalConstants.PRIORITY);
    Long ttl    = (Long)   destProps.remove(JmsInternalConstants.TIME_TO_LIVE);

    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, " isTopic=" + isTopic + " dm: " + dm + " pri: " + pri + " ttl: " + ttl);

    // Establsh the half-byte value for Delivery Mode
    byte dmByte = DM_NOT_SET;
    if ((dm != null) && (!ApiJmsConstants.DELIVERY_MODE_APP.equals(dm))) {
      if (ApiJmsConstants.DELIVERY_MODE_PERSISTENT.equals(dm)) {
        dmByte = DM_PERSISTENT;
      }
      else if (ApiJmsConstants.DELIVERY_MODE_NONPERSISTENT.equals(dm)) {
        dmByte = DM_NON_PERSISTENT;
      }
    }

    // Populate the first byte with the Queue/Topic and DM information
    if (isTopic) {
      baos.write(TOPIC_TYPE | dmByte);
    }
    else {
      baos.write(QUEUE_TYPE | dmByte);
    }

    // Establish the half-byte value for the Priority
    byte priByte = PRIORITY_NOT_SET;
    if (pri != null) {
      priByte = (byte)(pri.byteValue() << 4);
    }

    // Populate the 2nd byte with the Priority & TTL-setness information,
    // followed by the TTL itself if there is one.
    // Note that a TTL of 0 is not equivalent to no TTL (which implies AsApplication)
    if ((ttl == null)) {
      baos.write(priByte | TTL_NOT_SET);
    }
    else {
      baos.write(priByte | TTL_SET);

      // If we do have a TTL, we write it out in big-endian, though unfortunately
      // we need an 8 byte array for ArrayUtil to write into.
      // Theoretically we could use ObjectOutStream to write directly, but we can't
      // 'guarantee' the output would be compatible with the old hand-rolled encoding.
      // At least ArrayUtil is more efficient than the old-way and we know it is compatible.
      byte[] ttlBytes = new byte[8];
      ArrayUtil.writeLong(ttlBytes, 0, ttl);
      baos.write(ttlBytes, 0, 8);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Encoded basic information: " + SibTr.formatBytes(baos.toByteArray()));
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "encodeBasicProperties");
  }
private static void encodeBasicProperties ( ByteArrayOutputStream baos , boolean isTopic , Map < String , Object > destProps ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "encodeBasicProperties" , new Object [ ] { baos , isTopic , destProps } ) ; String dm = ( String ) destProps . remove ( JmsInternalConstants . DELIVERY_MODE ) ; Integer pri = ( Integer ) destProps . remove ( JmsInternalConstants . PRIORITY ) ; Long ttl = ( Long ) destProps . remove ( JmsInternalConstants . TIME_TO_LIVE ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , " isTopic=" + isTopic + " dm: " + dm + " pri: " + pri + " ttl: " + ttl ) ; byte dmByte = DM_NOT_SET ; if ( ( dm != null ) && ( ! ApiJmsConstants . DELIVERY_MODE_APP . equals ( dm ) ) ) { if ( ApiJmsConstants . DELIVERY_MODE_PERSISTENT . equals ( dm ) ) { dmByte = DM_PERSISTENT ; } else if ( ApiJmsConstants . DELIVERY_MODE_NONPERSISTENT . equals ( dm ) ) { dmByte = DM_NON_PERSISTENT ; } } if ( isTopic ) { baos . write ( TOPIC_TYPE | dmByte ) ; } else { baos . write ( QUEUE_TYPE | dmByte ) ; } byte priByte = PRIORITY_NOT_SET ; if ( pri != null ) { priByte = ( byte ) ( pri . byteValue ( ) << 4 ) ; } if ( ( ttl == null ) ) { baos . write ( priByte | TTL_NOT_SET ) ; } else { baos . write ( priByte | TTL_SET ) ; byte [ ] ttlBytes = new byte [ 8 ] ; ArrayUtil . writeLong ( ttlBytes , 0 , ttl ) ; baos . write ( ttlBytes , 0 , 8 ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Encoded basic information: " + SibTr . formatBytes ( baos . toByteArray ( ) ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "encodeBasicProperties" ) ; }
encodeBasicProperties
Encode the basic information about the JmsDestination:
Queue or Topic
DeliveryMode
Priority
TimeToLive

@param baos                 The ByteArrayOutputStream to encode into
@param isTopic              true if the Destination is a Topic, otherwise false
@param destProps            The Map of properties to be encoded