jdk1.6.0_45 如下代码有问题,高手能指出原理吗?

    public  String decodeByteBuff(ByteBuf buf) throws IOException, DataFormatException {
    
           byte[] temp = new byte[buf.readableBytes()];
           ByteBufInputStream bis = new ByteBufInputStream(buf);
           bis.read(temp);
           bis.close();
           Inflater decompresser = new Inflater(true);
           decompresser.setInput(temp, 0, temp.length);
           StringBuilder sb = new StringBuilder();
           byte[] result = new byte[1024];
           while (!decompresser.finished()) {
                int resultLength = decompresser.inflate(result);
                sb.append(new String(result, 0, resultLength, "UTF-8"));
           }
           decompresser.end();
           return sb.toString();
    }

上面那段代码在jdk7没任何问题,在jdk1.6.0_4,占用cpu 100%
郁闷,是jdk的bug吗?有高手解答下吗?

阅读 2.2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题