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