if (st.countTokens() != 2) {
throw new IllegalArgumentException("Illegal OID range specified: '" + oid);
}
oid = st.nextToken();
VariableBinding vbLower = new VariableBinding(new OID(oid));
vbs.add(vbLower);
long last = Long.parseLong(st.nextToken());
long first = vbLower.getOid().lastUnsigned();
for (long k = first + 1; k <= last; k++) {
OID nextOID = new OID(vbLower.getOid().getValue(), 0, vbLower.getOid().size() - 1);
nextOID.appendUnsigned(k);
VariableBinding next = new VariableBinding(nextOID);
vbs.add(next);
}
return;
}
VariableBinding vb = new VariableBinding(new OID(oid));
if (value != null) {
Variable variable;
switch (type) {
case 'i': {
variable = new Integer32(Integer.parseInt(value));
break;
}
case 'u': {
variable = new UnsignedInteger32(Long.parseLong(value));
break;
}
case 's': {
variable = new OctetString(value);
break;
}
case 'x': {
variable = OctetString.fromString(value, ':', 16);
break;
}
case 'd': {
variable = OctetString.fromString(value, '.', 10);
break;
}
case 'b': {
variable = OctetString.fromString(value, ' ', 2);
break;
}
case 'n': {
variable = new Null();
break;
}
case 'o': {
variable = new OID(value);
break;
}
case 't': {
variable = new TimeTicks(Long.parseLong(value));
break;
}
case 'a': {
variable = new IpAddress(value);
break;
}
default: {
throw new IllegalArgumentException("Variable type " + type + " not supported");
}
}
vb.setVariable(variable);
}
vbs.add(vb);
}