-/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.handler.codec.MessageToByteEncoder;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * Transforms OpenFlow Protocol messages to POJOs\r
- * @author michal.polkorab\r
- * @author timotej.kubas\r
- */\r
-public class OFEncoder extends MessageToByteEncoder<OfHeader> {\r
-\r
- private static final Logger LOGGER = LoggerFactory.getLogger(OFEncoder.class);\r
- \r
- /** Constructor of class */\r
- public OFEncoder() {\r
- LOGGER.debug("Creating OF13Encoder");\r
- }\r
- \r
- @Override\r
- protected void encode(ChannelHandlerContext ctx, OfHeader msg, ByteBuf out)\r
- throws Exception {\r
- LOGGER.debug("Encoding");\r
- try {\r
- SerializationFactory.messageToBuffer(msg.getVersion(), out, msg);\r
- } catch(Exception e) {\r
- LOGGER.error("Message serialization failed");\r
- LOGGER.error(e.getMessage(), e);\r
- return;\r
- }\r
- if (out.readableBytes() > 0) {\r
- out.retain();\r
- ctx.writeAndFlush(out);\r
- } else {\r
- LOGGER.warn("Translated buffer is empty");\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.openflowjava.protocol.impl.core;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.MessageToByteEncoder;
+
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Transforms OpenFlow Protocol messages to POJOs
+ * @author michal.polkorab
+ * @author timotej.kubas
+ */
+public class OFEncoder extends MessageToByteEncoder<OfHeader> {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(OFEncoder.class);
+
+ /** Constructor of class */
+ public OFEncoder() {
+ LOGGER.debug("Creating OF13Encoder");
+ }
+
+ @Override
+ protected void encode(ChannelHandlerContext ctx, OfHeader msg, ByteBuf out)
+ throws Exception {
+ LOGGER.debug("Encoding");
+ try {
+ SerializationFactory.messageToBuffer(msg.getVersion(), out, msg);
+ } catch(Exception e) {
+ LOGGER.error("Message serialization failed");
+ LOGGER.error(e.getMessage(), e);
+ return;
+ }
+ if (out.readableBytes() > 0) {
+ out.retain();
+ ctx.writeAndFlush(out);
+ } else {
+ LOGGER.warn("Translated buffer is empty");
+ }
+ }
+
+}