import java.io.*;
String sFile = "c:/test.pdf"; //下载文件路径及文件格式,可根据实际场景指定文件格式(pdf/excel/png等)
File file = new File(sFile); //
byte[] res = prev.getResponseData(); //获取前面的sample返回的信息(接口返回的二进制流)
FileOutputStream fos = new FileOutputStream(file);
fos.write(res); //写入本地文件
fos.close(); //关闭FileOutputStream及与其相关的系统资源(Closes this file output stream and releases any system resources associated with this stream. This file output stream may no longer be used for writing bytes. If this stream has an associated channel then the channel is closed as well.)
Jmeter使用BeanShell下载附件
最新推荐文章于 2024-06-29 20:35:33 发布