Renamed packages to org.opendaylight.openflowjava.protocol.impl.*
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / util / BufferHelper.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
2 package org.opendaylight.openflowjava.protocol.impl.util;\r
3 \r
4 import io.netty.buffer.ByteBuf;\r
5 import io.netty.buffer.UnpooledByteBufAllocator;\r
6 \r
7 /**\r
8  * @author michal.polkorab\r
9  *\r
10  */\r
11 public abstract class BufferHelper {\r
12 \r
13     /**\r
14      * \r
15      */\r
16     private static final byte[] XID = new byte[]{0x01, 0x02, 0x03, 0x04};\r
17 \r
18     /**\r
19      * @param payload\r
20      * @return ByteBuf filled with OpenFlow protocol message without first 2 bytes\r
21      */\r
22     public static ByteBuf buildBuffer(byte[] payload) {\r
23         ByteBuf bb = UnpooledByteBufAllocator.DEFAULT.buffer();\r
24         bb.writeBytes(XID);\r
25         bb.writeBytes(payload);\r
26         return bb;\r
27     }\r
28 \r
29 }\r