本文整理汇总了Java中org.onosproject.pcepio.protocol.PcepLabelRangeObject类的典型用法代码示例。如果您正苦于以下问题:Java PcepLabelRangeObject类的具体用法?Java PcepLabelRangeObject怎么用?Java PcepLabelRangeObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PcepLabelRangeObject类属于org.onosproject.pcepio.protocol包,在下文中一共展示了PcepLabelRangeObject类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
/**
* Reads from the channel buffer and returns object of PcepLabelRangeObject.
*
* @param cb of type channel buffer
* @return object of PcepLabelRangeObject
* @throws PcepParseException when fails to read from channel buffer
*/
public static PcepLabelRangeObject read(ChannelBuffer cb) throws PcepParseException {
PcepObjectHeader labelRangeObjHeader;
byte labelType;
int rangeSize;
int labelBase;
LinkedList<PcepValueType> llOptionalTlv = new LinkedList<>();
labelRangeObjHeader = PcepObjectHeader.read(cb);
//take only LabelRangeObject buffer.
ChannelBuffer tempCb = cb.readBytes(labelRangeObjHeader.getObjLen() - MINIMUM_COMMON_HEADER_LENGTH);
int temp = 0;
temp = tempCb.readInt();
rangeSize = temp & 0x00FFFFFF;
labelType = (byte) (temp >> 24);
labelBase = tempCb.readInt();
llOptionalTlv = parseOptionalTlv(tempCb);
return new PcepLabelRangeObjectVer1(labelRangeObjHeader, labelType, rangeSize, labelBase, llOptionalTlv);
}
示例2: build
import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
@Override
public PcepLabelRangeObject build() throws PcepParseException {
PcepObjectHeader labelRangeObjHeader = this.bIsHeaderSet ? this.labelRangeObjHeader
: DEFAULT_LABELRANGE_OBJECT_HEADER;
if (!this.bIsLabelType) {
throw new PcepParseException("LabelType NOT Set while building label range object.");
}
if (!this.bIsRangeSize) {
throw new PcepParseException("RangeSize NOT Set while building label range object.");
}
if (!this.bIsLabelBase) {
throw new PcepParseException("LabelBase NOT Set while building label range object.");
}
if (bIsPFlagSet) {
labelRangeObjHeader.setPFlag(bPFlag);
}
if (bIsIFlagSet) {
labelRangeObjHeader.setIFlag(bIFlag);
}
return new PcepLabelRangeObjectVer1(labelRangeObjHeader, this.labelType, this.rangeSize, this.labelBase,
this.llOptionalTlv);
}
示例3: read
import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
/**
* Reads channel buffer and returns object of PcepLabelRange.
*
* @param cb of type channel buffer.
* @return object of PcepLabelRange
* @throws PcepParseException when fails to read from channel buffer
*/
public static PcepLabelRange read(ChannelBuffer cb) throws PcepParseException {
//parse and store SRP mandatory object
PcepSrpObject srpObj = null;
srpObj = PcepSrpObjectVer1.read(cb);
if (srpObj == null) {
throw new PcepParseException("Exception while parsing srp object");
}
LinkedList<PcepLabelRangeObject> llLabelRangeList = new LinkedList<>();
boolean bFoundLabelRangeObj = false;
while (0 < cb.readableBytes()) {
//parse and store <labelrange-list>
PcepLabelRangeObject lrObj;
lrObj = PcepLabelRangeObjectVer1.read(cb);
if (lrObj == null) {
throw new PcepParseException("Exception while parsing label range object");
} else {
llLabelRangeList.add(lrObj);
bFoundLabelRangeObj = true;
}
}
if (!bFoundLabelRangeObj) {
throw new PcepParseException("At least one LABEL-RANGE MUST be present.");
}
return new PcepLabelRangeVer1(srpObj, llLabelRangeList);
}
示例4: write
import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
@Override
public int write(ChannelBuffer cb) throws PcepParseException {
//write Object header
int objStartIndex = cb.writerIndex();
//write <SRP>
int objLenIndex = srpObject.write(cb);
if (objLenIndex <= 0) {
throw new PcepParseException("bjectLength is " + objLenIndex);
}
//write <labelrange-list>
ListIterator<PcepLabelRangeObject> listIterator = llLabelRangeList.listIterator();
while (listIterator.hasNext()) {
listIterator.next().write(cb);
}
//Update object length now
int length = cb.writerIndex() - objStartIndex;
// As per RFC the length of object should be
// multiples of 4
int pad = length % 4;
if (pad != 0) {
pad = 4 - pad;
for (int i = 0; i < pad; i++) {
cb.writeByte((byte) 0);
}
length = length + pad;
}
cb.setShort(objLenIndex, (short) length);
return length;
}
示例5: buildPcepLabelRangeObject
import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
@Override
public PcepLabelRangeObject.Builder buildPcepLabelRangeObject() {
return new PcepLabelRangeObjectVer1.Builder();
}
示例6: getLabelRangeList
import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
@Override
public LinkedList<PcepLabelRangeObject> getLabelRangeList() {
return llLabelRangeList;
}
示例7: setLabelRangeList
import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
@Override
public void setLabelRangeList(LinkedList<PcepLabelRangeObject> ll) {
this.llLabelRangeList = ll;
}
示例8: PcepLabelRangeVer1
import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
/**
* Constructor to initialize objects.
*
* @param srpObj PCEP Srp object.
* @param llLabelRangeList list of PcepLabelRangeObject.
*/
PcepLabelRangeVer1(PcepSrpObject srpObj, LinkedList<PcepLabelRangeObject> llLabelRangeList) {
this.srpObject = srpObj;
this.llLabelRangeList = llLabelRangeList;
}