コード例 #1
0
  /**
   * The attributes will be encoded as a sequence of: - A UTF-8 byte representation of the attribute
   * name. - A zero delimiter - A one-to-five byte number of values for the attribute - A sequence
   * of: - A one-to-five byte length for the value - A UTF-8 byte representation for the value
   */
  private void append(ByteStringBuilder buffer, Map<AttributeType, List<Attribute>> attributes) {
    for (List<Attribute> attrList : attributes.values()) {
      for (Attribute a : attrList) {
        byte[] nameBytes = getBytes(a.getNameWithOptions());
        buffer.appendBytes(nameBytes);
        buffer.appendByte(0x00);

        buffer.appendBERLength(a.size());
        for (ByteString v : a) {
          buffer.appendBERLength(v.length());
          buffer.appendBytes(v);
        }
      }
    }
  }