本文整理汇总了Java中net.jradius.packet.attribute.RadiusAttribute.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java RadiusAttribute.getValue方法的具体用法?Java RadiusAttribute.getValue怎么用?Java RadiusAttribute.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.jradius.packet.attribute.RadiusAttribute
的用法示例。
在下文中一共展示了RadiusAttribute.getValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getKeyFromAttributeType
import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
protected Serializable getKeyFromAttributeType(RadiusPacket req, long type, boolean required) throws RadiusException
{
RadiusAttribute a = req.findAttribute(type);
if (a == null)
{
if (required)
{
a = AttributeFactory.newAttribute(type, null, false);
throw new RadiusException("Missing required attribute: " + a.getAttributeName());
}
return null;
}
AttributeValue v = a.getValue();
return v.toString();
}
示例2: createNamedValueCellEditor
import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
private JComboBox createNamedValueCellEditor(String attributeName)
{
JComboBox comboBox = (JComboBox)namedValueComponentCache.get(attributeName);
if (comboBox != null) return comboBox;
try
{
RadiusAttribute attribute = AttributeFactory.newAttribute(attributeName);
NamedValue namedValue = (NamedValue)attribute.getValue();
NamedValueMap valueMap = namedValue.getMap();
Long[] possibleValues = valueMap.getKnownValues();
comboBox = new JComboBox();
for (int i=0; i<possibleValues.length;i++)
{
comboBox.addItem(valueMap.getNamedValue(possibleValues[i]));
}
namedValueComponentCache.put(attributeName, comboBox);
}
catch (Exception e) { e.printStackTrace(); }
return comboBox;
}
示例3: packAttribute
import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
/**
* Packs a RadiusAttribute into a DataOutputStream
* @param out The DataOutputStream to write attributes to
* @param a The RadiusAttribute to pack
* @throws IOException
public void packAttribute(OutputStream out, RadiusAttribute a) throws IOException
{
AttributeValue attributeValue = a.getValue();
packHeader(out, a);
attributeValue.getBytes(out);
}
*/
public void packAttribute(ByteBuffer buffer, RadiusAttribute a)
{
AttributeValue attributeValue = a.getValue();
if (a instanceof VSAttribute)
{
VSAttribute vsa = (VSAttribute) a;
if (vsa.hasContinuationByte())
{
int headerLength = headerLength(vsa);
int valueLength = attributeValue.getLength();
int maxLength = 255 - headerLength;
int len;
if (valueLength > maxLength)
{
for (int off = 0; off < valueLength; off += maxLength)
{
len = valueLength - off;
if (len > maxLength)
{
len = maxLength;
vsa.setContinuation();
}
else
{
vsa.unsetContinuation();
}
packHeader(buffer, a, len);
attributeValue.getBytes(buffer, off, len);
}
return;
}
}
}
packHeader(buffer, a);
attributeValue.getBytes(buffer);
}
示例4: getAttributeValue
import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
/**
* @param aName The name of the attribute to find
* @return Returns the Object value of the found attribute, otherwise null
* @throws UnknownAttributeException
*/
public Object getAttributeValue(String aName)
throws UnknownAttributeException
{
RadiusAttribute attribute = findAttribute(aName);
if (attribute != null)
{
AttributeValue value = attribute.getValue();
if (value != null)
{
return value.getValueObject();
}
}
return null;
}
示例5: setAccountingStatusType
import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
public void setAccountingStatusType(int type)
{
RadiusAttribute a = AttributeFactory.newAttribute(AttributeDictionary.ACCT_STATUS_TYPE, null, isRecyclable());
NamedValue s = (NamedValue)a.getValue();
s.setValue(new Long(type));
overwriteAttribute(a);
}
示例6: packAttribute
import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
public void packAttribute(ByteBuffer buffer, RadiusAttribute a)
{
AttributeValue attributeValue = a.getValue();
int length = attributeValue.getLength();
int padding = ((length + 0x03) & ~(0x03)) - length;
packHeader(buffer, a);
attributeValue.getBytes(buffer);
while (padding-- > 0) putUnsignedByte(buffer, 0);
}
示例7: packHeader
import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
public void packHeader(ByteBuffer buffer, RadiusAttribute a)
{
if (a instanceof VSAttribute)
{
packHeader(buffer, (VSAttribute) a);
return;
}
AttributeValue attributeValue = a.getValue();
putUnsignedInt(buffer, a.getType());
putUnsignedByte(buffer, 0);
putUnsignedByte(buffer, 0); // part of the AVP Length!
putUnsignedShort(buffer, attributeValue.getLength() + 8);
}
示例8: packAttribute
import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
@Override
public void packAttribute(ByteBuffer buffer, RadiusAttribute a)
{
AttributeValue attributeValue = a.getValue();
putUnsignedByte(buffer, (int) a.getType());
putUnsignedByte(buffer, attributeValue.getLength() + 2);
attributeValue.getBytes(buffer);
}
示例9: packHeader
import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
/**
* @see net.jradius.packet.RadiusFormat#packHeader(java.io.OutputStream, net.jradius.packet.attribute.RadiusAttribute)
public void packHeader(OutputStream out, RadiusAttribute a) throws IOException
{
AttributeValue attributeValue = a.getValue();
writeUnsignedInt(out, a.getFormattedType());
writeUnsignedInt(out, attributeValue.getLength());
writeUnsignedInt(out, a.getAttributeOp());
}
*/
public void packHeader(ByteBuffer buffer, RadiusAttribute a)
{
AttributeValue attributeValue = a.getValue();
putUnsignedInt(buffer, a.getFormattedType());
putUnsignedInt(buffer, attributeValue.getLength());
putUnsignedInt(buffer, a.getAttributeOp());
}