首页 > 编程语言 > 详细

JAVA接收postman的中raw的参数

时间:2019-08-30 20:25:29      阅读:2077      评论:0      收藏:0      [点我收藏+]
/**
 * java获取raw
 */
public static String readRaw(InputStream inputStream) {

    String result = "";
    try {
        ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
        byte[] buffer = new byte[1024];

        int len;
        while ((len = inputStream.read(buffer)) != -1) {
            outSteam.write(buffer, 0, len);
        }

        outSteam.close();
        inputStream.close();

        result = new String(outSteam.toByteArray(), "UTF-8");

    } catch (IOException e) {
        e.printStackTrace();
    }

    return result;
}

  

调用:

String result = FileUtils.readRaw(request.getInputStream());  //result就是raw中的数据

  

JAVA接收postman的中raw的参数

原文:https://www.cnblogs.com/pxblog/p/11436562.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!