[SNMP4J] request
David Hustace
david at opennms.org
Tue Apr 19 15:10:43 CEST 2005
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.
More information about the SNMP4J
mailing list