@Test public void testGetLinkSubTypeTlvBodyAsByteArray() throws Exception { result = unreservedBandwidth.getLinkSubTypeTlvBodyAsByteArray(); assertThat(result, is(notNullValue())); }
public byte[] getLinkSubTypeTlvBodyAsByteArray() { List<Byte> linkSubTypeBody = new ArrayList<>(); if (this.unReservedBandwidth.size() < 8) { int size = OspfUtil.EIGHT_BYTES - this.unReservedBandwidth.size(); for (int i = 0; i < size; i++) { linkSubTypeBody.addAll(Bytes.asList(OspfUtil.convertToFourBytes(OspfParameters.INITIAL_BANDWIDTH))); } } for (Float unreservedBandwidth : this.unReservedBandwidth) { int unresBandwidth = Float.floatToIntBits(unreservedBandwidth); linkSubTypeBody.addAll(Bytes.asList(OspfUtil.convertToFourBytes(unresBandwidth))); } return Bytes.toArray(linkSubTypeBody); }
UnreservedBandwidth extends TlvHeader implements LinkSubType { public byte[] getLinkSubTypeTlvBodyAsByteArray() { List<Byte> linkSubTypeBody = new ArrayList<>(); if (this.unReservedBandwidth.size() < 8) { int size = OspfUtil.EIGHT_BYTES - this.unReservedBandwidth.size(); for (int i = 0; i < size; i++) { linkSubTypeBody.addAll(Bytes.asList(OspfUtil.convertToFourBytes(OspfParameters.INITIAL_BANDWIDTH))); } } for (Float unreservedBandwidth : this.unReservedBandwidth) { int unresBandwidth = Float.floatToIntBits(unreservedBandwidth); linkSubTypeBody.addAll(Bytes.asList(OspfUtil.convertToFourBytes(unresBandwidth))); } return Bytes.toArray(linkSubTypeBody); } }
UnreservedBandwidth extends TlvHeader implements LinkSubType { public byte[] getLinkSubTypeTlvBodyAsByteArray() { List<Byte> linkSubTypeBody = new ArrayList<>(); if (this.unReservedBandwidth.size() < 8) { int size = OspfUtil.EIGHT_BYTES - this.unReservedBandwidth.size(); for (int i = 0; i < size; i++) { linkSubTypeBody.addAll(Bytes.asList(OspfUtil.convertToFourBytes(OspfParameters.INITIAL_BANDWIDTH))); } } for (Float unreservedBandwidth : this.unReservedBandwidth) { int unresBandwidth = Float.floatToIntBits(unreservedBandwidth); linkSubTypeBody.addAll(Bytes.asList(OspfUtil.convertToFourBytes(unresBandwidth))); } return Bytes.toArray(linkSubTypeBody); } UnreservedBandwidth(TlvHeader header); }
UnreservedBandwidth extends TlvHeader implements LinkSubType { public byte[] getLinkSubTypeTlvBodyAsByteArray() { List<Byte> linkSubTypeBody = new ArrayList<>(); if (this.unReservedBandwidth.size() < 8) { int size = OspfUtil.EIGHT_BYTES - this.unReservedBandwidth.size(); for (int i = 0; i < size; i++) { linkSubTypeBody.addAll(Bytes.asList(OspfUtil.convertToFourBytes(OspfParameters.INITIAL_BANDWIDTH))); } } for (Float unreservedBandwidth : this.unReservedBandwidth) { int unresBandwidth = Float.floatToIntBits(unreservedBandwidth); linkSubTypeBody.addAll(Bytes.asList(OspfUtil.convertToFourBytes(unresBandwidth))); } return Bytes.toArray(linkSubTypeBody); } UnreservedBandwidth(TlvHeader header); void addUnReservedBandwidth(float unreservedBandwidth); List<Float> getUnReservedBandwidthValue(); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLinkSubTypeTlvBodyAsByteArray(); @Override String toString(); }
UnreservedBandwidth extends TlvHeader implements LinkSubType { public byte[] getLinkSubTypeTlvBodyAsByteArray() { List<Byte> linkSubTypeBody = new ArrayList<>(); if (this.unReservedBandwidth.size() < 8) { int size = OspfUtil.EIGHT_BYTES - this.unReservedBandwidth.size(); for (int i = 0; i < size; i++) { linkSubTypeBody.addAll(Bytes.asList(OspfUtil.convertToFourBytes(OspfParameters.INITIAL_BANDWIDTH))); } } for (Float unreservedBandwidth : this.unReservedBandwidth) { int unresBandwidth = Float.floatToIntBits(unreservedBandwidth); linkSubTypeBody.addAll(Bytes.asList(OspfUtil.convertToFourBytes(unresBandwidth))); } return Bytes.toArray(linkSubTypeBody); } UnreservedBandwidth(TlvHeader header); void addUnReservedBandwidth(float unreservedBandwidth); List<Float> getUnReservedBandwidthValue(); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLinkSubTypeTlvBodyAsByteArray(); @Override String toString();  }