JAVA接收postman的中raw的参数
/** * 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中的数据
-----------------------有任何问题可以在评论区评论,也可以私信我,我看到的话会进行回复,欢迎大家指教------------------------
(蓝奏云官网有些地址失效了,需要把请求地址lanzous改成lanzoux才可以)