赞
踩
字节流转字符串处理
public class ByteUtil { public static String byteBufferToString(ByteBuffer buffer) { CharBuffer charBuffer = null; try { Charset charset = Charset.forName("UTF-8"); CharsetDecoder decoder = charset.newDecoder(); charBuffer = decoder.decode(buffer); buffer.flip(); return charBuffer.toString(); } catch (Exception ex) { ex.printStackTrace(); return null; } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。