Esempio n. 1
0
  public static void print() throws Exception {

    if (flag) {
      String name = new Object() {}.getClass().getEnclosingClass().getName();

      int len = 0;
      int off = 0;
      for (PacketHeader fld : PacketHeader.values()) {
        len = fld.getLen();

        if (flag)
          log.debug(
              String.format(
                  "[%s] [%s] [%3d:%3d] [%3d:%3d] [%20s] [%s] [%s]",
                  name,
                  fld.getType(),
                  off,
                  fld.getOff(),
                  len,
                  fld.getLen(),
                  fld.getName(),
                  fld.getDesc(),
                  fld.getDefVal()));

        off += fld.getLen();
      }

      if (flag) log.debug("Total Length = " + off);
    }
  }
Esempio n. 2
0
  private static int setLenTotal() throws Exception {

    if (lenTotal < 0) {

      int off = 0;

      for (PacketHeader fld : PacketHeader.values()) {
        off += fld.getLen();
      }

      lenTotal = off;
    }

    return lenTotal;
  }