當前位置: 首頁>>代碼示例>>Java>>正文


Java Attribute.size方法代碼示例

本文整理匯總了Java中javax.naming.directory.Attribute.size方法的典型用法代碼示例。如果您正苦於以下問題:Java Attribute.size方法的具體用法?Java Attribute.size怎麽用?Java Attribute.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.naming.directory.Attribute的用法示例。


在下文中一共展示了Attribute.size方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAttributeValues

import javax.naming.directory.Attribute; //導入方法依賴的package包/類
/**
 * Get the values for the given attribute. If the attribute is null
 * or does not contain any values, a zero length byte array is
 * returned. NOTE that it is assumed that all values are byte arrays.
 */
private byte[][] getAttributeValues(Attribute attr)
        throws NamingException {
    byte[][] values;
    if (attr == null) {
        values = BB0;
    } else {
        values = new byte[attr.size()][];
        int i = 0;
        NamingEnumeration<?> enum_ = attr.getAll();
        while (enum_.hasMore()) {
            Object obj = enum_.next();
            if (debug != null) {
                if (obj instanceof String) {
                    debug.println("LDAPCertStore.getAttrValues() "
                        + "enum.next is a string!: " + obj);
                }
            }
            byte[] value = (byte[])obj;
            values[i++] = value;
        }
    }
    return values;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:29,代碼來源:LDAPCertStore.java

示例2: getHeaderFields

import javax.naming.directory.Attribute; //導入方法依賴的package包/類
/**
 * Returns an unmodifiable Map of the header fields.
 */
public Map getHeaderFields() {

  if (!connected) {
      // Try to connect (silently)
      try {
          connect();
      } catch (IOException e) {
      }
  }

  if (attributes == null)
      return (Collections.EMPTY_MAP);

  HashMap headerFields = new HashMap(attributes.size());
  NamingEnumeration attributeEnum = attributes.getIDs();
  try {
      while (attributeEnum.hasMore()) {
          String attributeID = (String)attributeEnum.next();
          Attribute attribute = attributes.get(attributeID);
          if (attribute == null) continue;
          ArrayList attributeValueList = new ArrayList(attribute.size());
          NamingEnumeration attributeValues = attribute.getAll();
          while (attributeValues.hasMore()) {
              Object attrValue = attributeValues.next();
              attributeValueList.add(getHeaderValueAsString(attrValue));
          }
          attributeValueList.trimToSize(); // should be a no-op if attribute.size() didn't lie
          headerFields.put(attributeID, Collections.unmodifiableList(attributeValueList));
      }
  } catch (NamingException ne) {
        // Shouldn't happen
  }

  return Collections.unmodifiableMap(headerFields);

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:40,代碼來源:DirContextURLConnection.java

示例3: getHeaderFields

import javax.naming.directory.Attribute; //導入方法依賴的package包/類
/**
 * Returns an unmodifiable Map of the header fields.
 */
@Override
public Map<String,List<String>> getHeaderFields() {

  if (!connected) {
      // Try to connect (silently)
      try {
          connect();
      } catch (IOException e) {
          //Ignore
      }
  }

  if (attributes == null)
      return (Collections.emptyMap());

  HashMap<String,List<String>> headerFields =
      new HashMap<String,List<String>>(attributes.size());
  NamingEnumeration<String> attributeEnum = attributes.getIDs();
  try {
      while (attributeEnum.hasMore()) {
          String attributeID = attributeEnum.next();
          Attribute attribute = attributes.get(attributeID);
          if (attribute == null) continue;
          ArrayList<String> attributeValueList =
              new ArrayList<String>(attribute.size());
          NamingEnumeration<?> attributeValues = attribute.getAll();
          while (attributeValues.hasMore()) {
              Object attrValue = attributeValues.next();
              attributeValueList.add(getHeaderValueAsString(attrValue));
          }
          attributeValueList.trimToSize(); // should be a no-op if attribute.size() didn't lie
          headerFields.put(attributeID, Collections.unmodifiableList(attributeValueList));
      }
  } catch (NamingException ne) {
        // Shouldn't happen
  }

  return Collections.unmodifiableMap(headerFields);

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:44,代碼來源:DirContextURLConnection.java

示例4: getHeaderFields

import javax.naming.directory.Attribute; //導入方法依賴的package包/類
/**
 * Returns an unmodifiable Map of the header fields.
 */
@Override
public Map<String, List<String>> getHeaderFields() {

	if (!connected) {
		// Try to connect (silently)
		try {
			connect();
		} catch (IOException e) {
			// Ignore
		}
	}

	if (attributes == null)
		return (Collections.emptyMap());

	HashMap<String, List<String>> headerFields = new HashMap<String, List<String>>(attributes.size());
	NamingEnumeration<String> attributeEnum = attributes.getIDs();
	try {
		while (attributeEnum.hasMore()) {
			String attributeID = attributeEnum.next();
			Attribute attribute = attributes.get(attributeID);
			if (attribute == null)
				continue;
			ArrayList<String> attributeValueList = new ArrayList<String>(attribute.size());
			NamingEnumeration<?> attributeValues = attribute.getAll();
			while (attributeValues.hasMore()) {
				Object attrValue = attributeValues.next();
				attributeValueList.add(getHeaderValueAsString(attrValue));
			}
			attributeValueList.trimToSize(); // should be a no-op if
												// attribute.size() didn't
												// lie
			headerFields.put(attributeID, Collections.unmodifiableList(attributeValueList));
		}
	} catch (NamingException ne) {
		// Shouldn't happen
	}

	return Collections.unmodifiableMap(headerFields);

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:45,代碼來源:DirContextURLConnection.java


注:本文中的javax.naming.directory.Attribute.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。