if (tlvs == null) {
return new byte[0];
}
- super.serializeTlvs(tlvs);
- int finalLength = 0;
- byte[] statefulBytes = null;
+ final byte[] prev = super.serializeTlvs(tlvs);
+ int finalLength = prev.length;
byte[] cleanupBytes = null;
- if (tlvs.getAugmentation(Tlvs2.class) != null) {
- final Tlvs2 statefulTlvs = tlvs.getAugmentation(Tlvs2.class);
- if (statefulTlvs.getStateful() != null) {
- statefulBytes = serializeTlv(statefulTlvs.getStateful());
- finalLength += statefulBytes.length;
- }
- }
if (tlvs.getAugmentation(Tlvs1.class) != null) {
final Tlvs1 cleanupTlv = tlvs.getAugmentation(Tlvs1.class);
if (cleanupTlv.getLspCleanup() != null) {
finalLength += cleanupBytes.length;
}
}
-
- int offset = 0;
final byte[] result = new byte[finalLength];
- if (statefulBytes != null) {
- ByteArray.copyWhole(statefulBytes, result, offset);
- offset += statefulBytes.length;
- }
+ ByteArray.copyWhole(prev, result, 0);
+ int offset = prev.length;
if (cleanupBytes != null) {
ByteArray.copyWhole(cleanupBytes, result, offset);
offset += cleanupBytes.length;
if (tlvs == null) {
return new byte[0];
}
- super.serializeTlvs(tlvs);
- int finalLength = 0;
+ final byte[] prev = super.serializeTlvs(tlvs);
+ int finalLength = prev.length;
byte[] nameBytes = null;
if (tlvs.getAugmentation(Tlvs2.class) != null) {
final Tlvs2 nameTlvs = tlvs.getAugmentation(Tlvs2.class);
finalLength += nameBytes.length;
}
}
- int offset = 0;
final byte[] result = new byte[finalLength];
+ ByteArray.copyWhole(prev, result, 0);
+ int offset = prev.length;
if (nameBytes != null) {
ByteArray.copyWhole(nameBytes, result, offset);
offset += nameBytes.length;
if (tlvs == null) {
return new byte[0];
}
- super.serializeTlvs(tlvs);
- int finalLength = 0;
+ final byte[] prev = super.serializeTlvs(tlvs);
+ int finalLength = prev.length;
byte[] statefulBytes = null;
byte[] nodeIdBytes = null;
if (tlvs.getAugmentation(Tlvs2.class) != null) {
}
}
- int offset = 0;
final byte[] result = new byte[finalLength];
+ ByteArray.copyWhole(prev, result, 0);
+ int offset = prev.length;
if (statefulBytes != null) {
ByteArray.copyWhole(statefulBytes, result, offset);
offset += statefulBytes.length;
if (tlvs == null) {
return new byte[0];
}
- super.serializeTlvs(tlvs);
- int finalLength = 0;
+ final byte[] prev = super.serializeTlvs(tlvs);
+ int finalLength = prev.length;
byte[] nameBytes = null;
if (tlvs.getAugmentation(Tlvs2.class) != null) {
final Tlvs2 nameTlvs = tlvs.getAugmentation(Tlvs2.class);
finalLength += nameBytes.length;
}
}
- int offset = 0;
final byte[] result = new byte[finalLength];
+ ByteArray.copyWhole(prev, result, 0);
+ int offset = prev.length;
if (nameBytes != null) {
ByteArray.copyWhole(nameBytes, result, offset);
offset += nameBytes.length;
if (tlvs == null) {
return new byte[0];
}
- super.serializeTlvs(tlvs);
- int finalLength = 0;
+ final byte[] prev = super.serializeTlvs(tlvs);
+ int finalLength = prev.length;
byte[] ofListBytes = null;
byte[] statefulBytes = null;
if (tlvs.getOfList() != null) {
finalLength += statefulBytes.length;
}
}
-
- int offset = 0;
final byte[] result = new byte[finalLength];
+ ByteArray.copyWhole(prev, result, 0);
+ int offset = prev.length;
if (ofListBytes != null) {
ByteArray.copyWhole(ofListBytes, result, offset);
offset += ofListBytes.length;