Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 我从web服务得到的响应是byte,如何将其显示为pdf_Android - Fatal编程技术网

Android 我从web服务得到的响应是byte,如何将其显示为pdf

Android 我从web服务得到的响应是byte,如何将其显示为pdf,android,Android,%PDF-1.4 %¢£ 30 obj 流动 ÿØÿà��JFIF����������ÿá��αExif����嗯��*��������>��������������v��������������F��������������Q��������������Q������������.!Q������������.!������������z&�� ������ ����ú���� ����è�� ����u0�� ����ê`�� ����:�� ����P�� �� ����±ÿÛ��C��

%PDF-1.4 %¢£ 30 obj 流动
ÿØÿà��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页。显示您的代码。