BUg-2825: optimize prefixForBytes/prefixForByteBuf 21/35421/5
authorRobert Varga <robert.varga@pantheon.sk>
Thu, 25 Feb 2016 20:02:33 +0000 (21:02 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 26 Feb 2016 13:42:15 +0000 (14:42 +0100)
commit4d5062600e78c4b8c3c2d0e85d454f72f67b8104
tree42b5c72d549093c5971ac58e5302f84356a9a318
parent2aac576b95150606a0d4258b6b57702579156a5b
BUg-2825: optimize prefixForBytes/prefixForByteBuf

Instead of always performing a copy, copy the array only on size
mismatch.

In prefixForByteBuf, allocate a bytearray which has correct size and
read into it -- the rest of it will be zero-initialized, just as it
should be.

Change-Id: I1e71e98e3efba2d731bb8be2c6cfb8062dec00e2
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
util/src/main/java/org/opendaylight/protocol/util/Ipv4Util.java
util/src/main/java/org/opendaylight/protocol/util/Ipv6Util.java