1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
\r
3 package org.opendaylight.openflowjava.protocol.impl.util;
\r
5 import io.netty.buffer.ByteBuf;
\r
7 /** Class for common operations on ByteBuf
\r
9 * @author michal.polkorab
\r
11 public abstract class ByteBufUtils {
\r
14 * Converts ByteBuf into String
\r
15 * @param bb input ByteBuf
\r
18 public static String byteBufToHexString(ByteBuf bb) {
\r
19 StringBuffer sb = new StringBuffer();
\r
20 for (int i = 0; i < bb.readableBytes(); i++) {
\r
21 short b = bb.getUnsignedByte(i);
\r
22 sb.append(String.format("%02x ", b));
\r
24 return sb.toString();
\r