输入流读取String字符串

来源:互联网 发布:saas平台数据库设计 编辑:程序博客网 时间:2024/06/18 03:47
        String gbk = "";        try {            InputStream is = request.getInputStream();            int streamLength = request.getContentLength();            byte[] b = new byte[streamLength];            int num = 0;            while ((num = is.read(b)) != -1) {                gbk = new String(b, 0, num, "utf-8");            }        } catch (IOException e) {            e.printStackTrace();        }
原创粉丝点击