cb9e18085867b2687403e96f3a01d52cbcd90881
[controller.git] / opendaylight / commons / protocol-framework / src / test / java / org / opendaylight / protocol / framework / SimpleByteToMessageDecoder.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.framework;
9
10 import io.netty.buffer.ByteBuf;
11 import io.netty.channel.ChannelHandlerContext;
12 import io.netty.handler.codec.ByteToMessageDecoder;
13
14 import java.util.List;
15
16 import com.google.common.base.Charsets;
17
18 /**
19  *
20  */
21 public class SimpleByteToMessageDecoder extends ByteToMessageDecoder {
22     @Override
23     protected void decode(final ChannelHandlerContext ctx, final ByteBuf in, final List<Object> out) {
24         out.add(new SimpleMessage(Charsets.UTF_8.decode(in.nioBuffer()).toString()));
25     }
26 }