com.github.qq275860560.common.util.ByteBufUtil Maven / Gradle / Ivy
package com.github.qq275860560.common.util;
import io.netty.buffer.ByteBuf;
/**
* @author [email protected]
*/
public class ByteBufUtil {
public static String toString(final ByteBuf byteBuf) {
final byte[] array = toArray(byteBuf);
return new String(array);
}
public static byte[] toArray(final ByteBuf byteBuf) {
final byte[] array = new byte[byteBuf.readableBytes()];
// byteBuf.getBytes(0, array);
byteBuf.readBytes(array);
return array;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy