本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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);
}