request.getInputStream() 的两种解析方式

http://sagewsg.iteye.com/blog/1717923

byte[] bytes = new byte[1024 * 1024];
        InputStream is;
        try {
            is = request.getInputStream();
            int nRead = 1;
            int nTotalRead = 0;
            while (nRead > 0) {
                nRead = is.read(bytes, nTotalRead, bytes.length - nTotalRead);
                if (nRead > 0)
                    nTotalRead = nTotalRead + nRead;
            }
            String str = new String(bytes, 0, nTotalRead, "utf-8");
            System.out.println("Str:" + str);
            res = str;
            is.close();
            is = null;
        } catch (IOException e) {
            e.printStackTrace();
        }
原文地址:https://www.cnblogs.com/stono/p/6561076.html