Example #1
0
    public static Type valueOf(UINT32 value) {
      Validators.notNull("value", value);

      if (!TYPE_MAP.containsKey(value)) {
        throw new IllegalArgumentException("Unknown Packet Type: " + value);
      }

      return TYPE_MAP.get(value);
    }
Example #2
0
    public static Type read(PtpInputStream pis) throws IOException {
      Validators.notNull("pis", pis);

      UINT32 typeValue = pis.readUINT32();
      return valueOf(typeValue);
    }