当前位置: 首页>>代码示例>>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;未经允许,请勿转载。