Changed output directory for generated classes
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / serialization / experimenters / OF10VendorInputMessageFactory.java
1 /*\r
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 \r
9 package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
10 \r
11 import io.netty.buffer.ByteBuf;\r
12 \r
13 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
14 import org.opendaylight.openflowjava.util.ByteBufUtils;\r
15 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
17 \r
18 /**\r
19  * Translates Vendor messages\r
20  * @author michal.polkorab\r
21  */\r
22 public class OF10VendorInputMessageFactory implements OFSerializer<ExperimenterInput> {\r
23 \r
24     private static final byte MESSAGE_TYPE = 4;\r
25     \r
26         @Override\r
27         public void serialize(ExperimenterInput input, ByteBuf outBuffer) {\r
28                 ByteBufUtils.writeOFHeader(MESSAGE_TYPE, input, outBuffer, EncodeConstants.EMPTY_LENGTH);\r
29         outBuffer.writeInt(input.getExperimenter().intValue());\r
30         byte[] data = input.getData();\r
31         if (data != null) {\r
32             outBuffer.writeBytes(data);\r
33         }\r
34         ByteBufUtils.updateOFHeaderLength(outBuffer);\r
35         }\r
36     \r
37 }