All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.qq275860560.common.util.ByteBufUtil Maven / Gradle / Ivy

There is a newer version: 201905061822
Show newest version
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