首先,我通过HttpURLConnection去请求一个url。
通过postman解析出来的header是这样的
Connection →keep-alive
X-Powered-By →Undertow/1
Server →WildFly/10
Content-Type →text/plain;charset=UTF-8
Date →Wed, 13 Mar 2019 05:50:43 GMT
Vary →Accept-Encoding
Content-Encoding →gzip
Transfer-Encoding →chunked
body是个字节数组
我后台用inputstream in = con.getInputStream()去接的
我想用流直接把文件输出到指定目录
但是现在有个问题,我文件输出出来了,但一打开就报错 -不是一个pdf文件或者已损坏