我正在尝试使用 HttpClient 下载 PDF 文件。我能够获取文件,但我不确定如何将字节转换为 PDF 并将其存储在系统的某个位置
我有以下代码,如何将其存储为 PDF?
public ???? getFile(String url) throws ClientProtocolException, IOException{
HttpGet httpget = new HttpGet(url);
HttpResponse response = httpClient.execute(httpget);
HttpEntity entity = response.getEntity();
if (entity != null) {
long len = entity.getContentLength();
InputStream inputStream = entity.getContent();
// How do I write it?
}
return null;
}