コード例 #1
0
ファイル: KeyTabEntry.java プロジェクト: ronshapiro/j86
  public int entryLength() {
    int totalPrincipalLength = 0;
    String[] names = service.getNameStrings();
    for (int i = 0; i < names.length; i++) {
      try {
        totalPrincipalLength += principalSize + names[i].getBytes("8859_1").length;
      } catch (UnsupportedEncodingException exc) {
      }
    }

    int realmLen = 0;
    try {
      realmLen = realm.toString().getBytes("8859_1").length;
    } catch (UnsupportedEncodingException exc) {
    }

    int size =
        principalComponentSize
            + realmSize
            + realmLen
            + totalPrincipalLength
            + principalTypeSize
            + timestampSize
            + keyVersionSize
            + keyTypeSize
            + keySize
            + keyblock.length;

    if (DEBUG) {
      System.out.println(">>> KeyTabEntry: key tab entry size is " + size);
    }
    return size;
  }