inputStream转File,获取到File,注意下方的文件名后缀请更改为自己文件的后缀
public static File asFile(InputStream inputStream) throws IOException{
File tmp = File.createTempFile("lzq", ".tmp", new File("C:\\"));
OutputStream os = new FileOutputStream(tmp);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
inputStream.close();
return tmp;
}