Example #1
0
 /**
  * Given the output from toString(), create a new SNMPAction
  *
  * @param val
  * @return
  */
 public static SNMPAction fromString(String val) {
   String tokens[] = val.split(";");
   if (!tokens[0].equals("ofaction"))
     throw new IllegalArgumentException("expected 'ofaction' but got '" + tokens[0] + "'");
   String type_tokens[] = tokens[1].split("=");
   String len_tokens[] = tokens[2].split("=");
   SNMPAction action = new SNMPAction();
   action.setLength(Short.valueOf(len_tokens[1]));
   action.setType(SNMPActionType.valueOf(type_tokens[1]));
   return action;
 }
Example #2
0
 public void readFrom(ByteBuffer data) {
   this.type = SNMPActionType.valueOf(data.getShort());
   this.length = data.getShort();
   // Note missing PAD, see MINIMUM_LENGTH comment for details
 }