java 读取 inputstream 到 string

var stream = request.getInputStream();
                    var baos = new ByteArrayOutputStream();
                    byte buff[] = new byte[1024];
                    int read;
                    while ((read = stream.read(buff)) > 0) {
                        baos.write(buff, 0, read);
                    }

                    var body = baos.toString();

 

posted on 2022-04-12 15:28  空明流光  阅读(465)  评论(0编辑  收藏  举报

导航