List of usage examples for io.netty.buffer CompositeByteBuf toString
@Override
public String toString(Charset charset)
From source file:org.asynchttpclient.netty.util.ByteBufUtils.java
License:Open Source License
public static String byteBuf2String(Charset charset, ByteBuf... bufs) throws CharacterCodingException { if (charset == UTF_8 || charset == US_ASCII) { return Utf8ByteBufCharsetDecoder.decodeUtf8(bufs); } else {/*from ww w . jav a2 s . c om*/ CompositeByteBuf composite = Unpooled.compositeBuffer(bufs.length); try { for (ByteBuf buf : bufs) { buf.retain(); composite.addComponent(buf); } return composite.toString(charset); } finally { composite.release(); } } }