Android 我从web服务得到的响应是byte,如何将其显示为pdf
%PDF-1.4 %¢£ 30 obj 流动Android 我从web服务得到的响应是byte,如何将其显示为pdf,android,Android,%PDF-1.4 %¢£ 30 obj 流动 ÿØÿà��JFIF����������ÿá��αExif����嗯��*��������>��������������v��������������F��������������Q��������������Q������������.!Q������������.!������������z&�� ������ ����ú���� ����è�� ����u0�� ����ê`�� ����:�� ����P�� �� ����±ÿÛ��C��
ÿØÿà��JFIF����<代码>��代码>����ÿá��αExif����嗯��*��������>��������������v��������������F��������������Q��������������Q������������.!Q������������.!������������z&�� ������ ����ú���� ����è�� ����u0�� ����ê`�� ����:�� ����P�� �� ����±ÿÛ��C�� $" &0P40,、0bFJ:Ptfzxrfpn¸npÚnpÚc |Î| |ò(200;)(206;)(255;)��C“$0*0^44”����)��k“��ÿÄ���������������������� 这是解决这个问题的办法。。 谢谢你的回复
try{
long lenghtOfFile = response.length;
//covert reponse to input stream
InputStream input = new ByteArrayInputStream(response);
File path = Environment.getExternalStorageDirectory();
File file = new File(path, filename);
map.put("resume_path", file.toString());
BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(file));
byte data[] = new byte[1024];
long total = 0;
while ((count = input.read(data)) != -1) {
total += count;
output.write(data, 0, count);
}
output.flush();
output.close();
input.close();
}catch(IOException e){
e.printStackTrace();
}
读取。只需将字节保存到文件中。@greenapps感谢您的回复,我正试图通过创建新文件将其保存为文件,即.pdf文件。但当我编写此pdf文件时,相同的字节数据将写入此文件,共75页。显示您的代码。