[SNMP4J] request

Fabrice Bacchella fabrice.bacchella at 9online.fr
Tue Apr 19 15:32:13 CEST 2005


Vector is supposed to be deprecated. ArrayList should be used instead.

Le 19 avr. 05, à 15:10, David Hustace a écrit :

>
> On Apr 19, 2005, at 8:25 AM, Deon van der Merwe wrote:
>
>>>
>>> requestPDU.addAll(vars);
>>> .....
>>
>> This is more or less how I do it.  As you can see, you do not need to 
>> use an array
>> at all.
>>
>>           vGETPdu.add(new org.snmp4j.smi.VariableBinding(new 
>> org.snmp4j.smi.OID("1.3.6.1.2.1.1")));
>
> Deon's method is usually preferable but if you have special 
> requirements where you need to dynamically build up a Vector and then 
> pass that as an Array to some constructor....
>
>         PDU requestPDU = null;
>         Vector v = new Vector();
>         v.add(new VariableBinding(new OID("1.3.6.1.2.1.1")));
>         v.add(new VariableBinding(new OID("1.3.6.1.2.1.2")));
>         v.add(new VariableBinding(new OID("1.3.6.1.2.1.3")));
>         VariableBinding[] ar = null;
>         v.copyInto(ar);
>         requestPDU.addAll(ar);
>
>
> -David Hustace
>
> P.S. This is a great API.
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
>

--
petite bibliothèque de curiosités à l'usage des explorateurs de 
l'imaginaire
www.castalie.fr




More information about the SNMP4J mailing list