@Test public void testReadFrom() throws Exception { header = new TlvHeader(); header.setTlvLength(4); header.setTlvType(8); channelBuffer = ChannelBuffers.copiedBuffer(packet); unreservedBandwidth = new UnreservedBandwidth(header); unreservedBandwidth.readFrom(channelBuffer); unreservedBandwidth.readFrom(channelBuffer); assertThat(unreservedBandwidth, is(notNullValue())); }
public void readFrom(ChannelBuffer channelBuffer) { while (channelBuffer.readableBytes() >= OspfUtil.FOUR_BYTES) { int maxReversibleBandwidth = channelBuffer.readInt(); this.addUnReservedBandwidth(Float.intBitsToFloat(maxReversibleBandwidth)); } }
UnreservedBandwidth extends TlvHeader implements LinkSubType { public void readFrom(ChannelBuffer channelBuffer) { while (channelBuffer.readableBytes() >= OspfUtil.FOUR_BYTES) { int maxReversibleBandwidth = channelBuffer.readInt(); this.addUnReservedBandwidth(Float.intBitsToFloat(maxReversibleBandwidth)); } } }
UnreservedBandwidth extends TlvHeader implements LinkSubType { public void readFrom(ChannelBuffer channelBuffer) { while (channelBuffer.readableBytes() >= OspfUtil.FOUR_BYTES) { int maxReversibleBandwidth = channelBuffer.readInt(); this.addUnReservedBandwidth(Float.intBitsToFloat(maxReversibleBandwidth)); } } UnreservedBandwidth(TlvHeader header); }
UnreservedBandwidth extends TlvHeader implements LinkSubType { public void readFrom(ChannelBuffer channelBuffer) { while (channelBuffer.readableBytes() >= OspfUtil.FOUR_BYTES) { int maxReversibleBandwidth = channelBuffer.readInt(); this.addUnReservedBandwidth(Float.intBitsToFloat(maxReversibleBandwidth)); } } 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 void readFrom(ChannelBuffer channelBuffer) { while (channelBuffer.readableBytes() >= OspfUtil.FOUR_BYTES) { int maxReversibleBandwidth = channelBuffer.readInt(); this.addUnReservedBandwidth(Float.intBitsToFloat(maxReversibleBandwidth)); } } UnreservedBandwidth(TlvHeader header); void addUnReservedBandwidth(float unreservedBandwidth); List<Float> getUnReservedBandwidthValue(); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); byte[] getLinkSubTypeTlvBodyAsByteArray(); @Override String toString();  }