code: public static void serializeTo( Destination destination , RawDataBuffer out )
      {
      	try
      	{
      		if (destination == null)
      		{
      			out.writeByte(NO_DESTINATION);
      		}
      		else
  	        if (destination instanceof Queue)
  	        {
  	            out.writeByte(TYPE_QUEUE);
  	            out.writeUTF(((Queue)destination).getQueueName());
  	        }
  	        else
              if (destination instanceof Topic)
              {
              	out.writeByte(TYPE_TOPIC);
                  out.writeUTF(((Topic)destination).getTopicName());
              }
              else
                  throw new IllegalArgumentException("Unsupported destination : "+destination);
      	}
      	catch (JMSException e)
      	{
      		throw new IllegalArgumentException("Cannot serialize destination : "+e.getMessage());
      	}
      }
docs: Serialize a destination to the given stream