Remove ByteBufWriteUtil.writeInt()
[bgpcep.git] / bmp / bmp-spi / src / main / java / org / opendaylight / protocol / bmp / spi / parser / AbstractBmpMessageParser.java
index 531b92cf590fd163b95ecd3179d1de6b6d1da7cd..9443d796a2ef7801e9b8ddd08c8d7d241fe21ff1 100644 (file)
@@ -5,17 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bmp.spi.parser;
 
+import static com.google.common.base.Preconditions.checkArgument;
 import static org.opendaylight.protocol.bmp.spi.parser.BmpMessageConstants.BMP_VERSION;
 import static org.opendaylight.protocol.bmp.spi.parser.BmpMessageConstants.COMMON_HEADER_LENGTH;
 
-import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufUtil;
 import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yangtools.yang.binding.Notification;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -26,7 +24,7 @@ public abstract class AbstractBmpMessageParser implements BmpMessageParser, BmpM
 
     @Override
     public final void serializeMessage(final Notification message, final ByteBuf buffer) {
-        Preconditions.checkArgument(message != null, "BMP message is mandatory.");
+        checkArgument(message != null, "BMP message is mandatory.");
         final ByteBuf bodyBuffer = Unpooled.buffer();
         serializeMessageBody(message, bodyBuffer);
         formatMessage(bodyBuffer, buffer);
@@ -35,7 +33,7 @@ public abstract class AbstractBmpMessageParser implements BmpMessageParser, BmpM
 
     @Override
     public final Notification parseMessage(final ByteBuf bytes) throws BmpDeserializationException {
-        Preconditions.checkArgument(bytes != null && bytes.isReadable());
+        checkArgument(bytes != null && bytes.isReadable());
         final Notification parsedMessage = parseMessageBody(bytes);
         LOG.trace("Parsed BMP message: {}", parsedMessage);
         return parsedMessage;
@@ -43,7 +41,7 @@ public abstract class AbstractBmpMessageParser implements BmpMessageParser, BmpM
 
     private void formatMessage(final ByteBuf body, final ByteBuf output) {
         output.writeByte(BMP_VERSION);
-        ByteBufWriteUtil.writeInt(body.writerIndex() + COMMON_HEADER_LENGTH, output);
+        output.writeInt(body.writerIndex() + COMMON_HEADER_LENGTH);
         output.writeByte(getBmpMessageType());
         output.writeBytes(body);
     }