I'm having difficulty downloading a pdf file with retrofit. My code produces a file, but it is the wrong size and when the pdf opens it is blank.
我无法通过改造下载pdf文件。我的代码生成一个文件,但它的大小错误,当pdf打开时,它是空白的。
This is how my php webservice returns a pdf file.
这是我的php webservice返回pdf文件的方式。
**
* @param Slim\Slim $app
* @param String $pdf
*/
function respondWithPDF($app, $pdf) {
$res = $app->response();
$res['Content-Description'] = 'File Transfer';
$res['Content-Type'] = 'application/octet-stream';
$res['Content-Disposition'] ='attachment; filename=' . basename($pdf);
$res['Content-Transfer-Encoding'] = 'binary';
$res['Expires'] = '0';
$res['Cache-Control'] = 'must-revalidate';
$res['Pragma'] = 'public';
$res['Content-Length'] = filesize($pdf);
readfile($pdf);
}
If I navigate to the api endpoint via browser, a pdf file downloads immediatley.
如果我通过浏览器导航到api端点,则pdf文件会下载immediatley。
This is the code I am using to download the pdf file in Android.
这是我用来在Android下载pdf文件的代码。
private boolean writeResponseBodyToDisk(ResponseBody body, String fileName) {
try {
File futureStudioIconFile = new File(mContext.getExternalCacheDir() + File.separator + fileName);
InputStream inputStream = null;
OutputStream outputStream = null;
try {
byte[] fileReader = new byte[4096];
long fileSize = body.contentLength();
long fileSizeDownloaded = 0;
inputStream = body.byteStream();
outputStream = new FileOutputStream(futureStudioIconFile);
while (true) {
int read = inputStream.read(fileReader);
if (read == -1) {
break;
}
outputStream.write(fileReader, 0, read);
fileSizeDownloaded += read;
Log.d(Constants.LOG_TAG, "file download: " + fileSizeDownloaded + " of " + fileSize);
}
outputStream.flush();
return true;
} catch (IOException e) {
return false;
} finally {
if (inputStream != null) {
inputStream.close();
}
if (outputStream != null) {
outputStream.close();
}
}
} catch (IOException e) {
return false;
}
}
I've been logging the http responses. Here is the response that I get with the pdf.
我一直在记录http响应。以下是我对pdf的回复。
D: ╔════════════════════════════════════════════════════════════════════════════════════════
D: ║ Thread: OkHttp https://192.168.1.15/mamobile/index.php/report/activity?startDate=3916-08-15%2000:00:00.000&endDate=3916-02-01%2000:00:00.000
D: ╟────────────────────────────────────────────────────────────────────────────────────────
D: ║ Call$ApplicationInterceptorChain.proceed (Call.java:232)
D: ║ ApiClient$LoggingInterceptor.intercept (ApiClient.java:247)
D: ╟────────────────────────────────────────────────────────────────────────────────────────
D: ║ response
D: ║ Received response for https://192.168.1.15/mamobile/index.php/report/activity?startDate=3916-08-15%2000:00:00.000&endDate=3916-02-01%2000:00:00.000 in 5190.8ms
D: ║ Cache-Control: must-revalidate
D: ║ Pragma: public
D: ║ Content-Length: 60942
D: ║ Content-Type: application/octet-stream
D: ║ Expires: 0
D: ║ Server: Microsoft-IIS/10.0
D: ║ X-Powered-By: PHP/5.4.24
D: ║ Content-Description: File Transfer
D: ║ Content-Disposition: attachment; filename=Activity Report.pdf
D: ║ Content-Transfer-Encoding: binary
D: ║ X-Powered-By: ASP.NET
D: ║ Date: Wed, 20 Jul 2016 16:52:17 GMT
D: ║ OkHttp-Sent-Millis: 1469033539269
D: ║ OkHttp-Received-Millis: 1469033544169
D: ║
D: ║ %PDF-1.3
D: ║ %����
D: ║ 1 0 obj
D: ║ <<
D: ║ /Type /Catalog
D: ║ /Pages 2 0 R
D: ║ /PageMode /UseNone
D: ║ /ViewerPreferences <<
D: ║ /FitWindow true
D: ║ /PageLayout /SinglePage
D: ║ /NonFullScreenPageMode /UseNone
D: ║ >>
D: ║ >>
D: ║ endobj
D: ║ 5 0 obj
D: ║ <<
D: ║ /Length 1394
D: ║ /Filter [ /FlateDecode ]
D: ║ >>
D: ║ stream
D: ║ v�X����:`��)��05~�z��gղZ?U+�IQ�A����+@�l!��l1�9��~V����X�]���I�0��=�ěg���o'@���)[P�2l��z\��jwL�}����Bk<�W���J�K"Hp*K;�E@����óL����� �`U
D: ║ ���XM�����d~���eO�40q��?��Y;N�K�����������⭒htgi��y�~{?��z;z���G?ٖKP�8�!��
D: ║ endobj
D: ║ 16 0 obj
D: ║ <<
D: ║ /Length 308
D: ║ /Filter [ /FlateDecode ]
D: ║ >>
D: ║ stream
D: ║ x�u��j�0��~
D: ║ ndstream
D: ║ endobj
D: ║ 19 0 obj
D: ║ <<
D: ║ /Length 8454
D: ║ /Length1 11968
D: ║ /Filter [ /FlateDecode ]
D: ║ >>
D: ║ stream
D: ║ 1%��D?A=\
D: ║ �Љq���
D: ║ "rvG<���6��h����m�ŏ�H�pe���0�X�����06�5Ɨ@3��ߡī��C�z���4�a*�;~Ѩ�����)APca<4��5<���dI9d�'�|�O��s�OA�ٱ
D: ║ s�(�����zx^@@?N�Mb��[�&�0�d��V�z�օ���3�Q�s��JxJ|/�I�
D: ║ �"�L�,��8��bl�{q>��K�fg�,�Mb��v';���e�2�+�
D: ║ �B�0K�NX.�)�;A\/>)nw���R��]��ټ���V����]�������5�5d�G�&O�w��A8BVy�����q���#zЋ>z3p(��D�o�[h�G�q܅��_���(��o�{� ���_a?�,��Y��������N�����6�W�O�`Gٻ�s��U>���Q��J^�;�~THR�ړ�������>AT�d1K*։w��C�]�Oʑ��n�n��I�� {�R�V�.���;�G *[��4�\L��6�˰�_�\��Љ�/�V6^�����CR*�f|
D: ║ ����B'����2�G�J��V�el!�
D: ║ ��~cc����Q��b�1�V1��+`<;,�A<4{-�bW���U�Mx`{�&�D@��*
D: ║ }��=P
D: ║ �#7�js5Ҥ!He|揂���H��R��<Z�EQ[uS�z��7�G�l5�u|��~�]�i�H��`��s�w0�?GG��h^��r5-$�8�,�������!2�7P�ȥ�d�@�Xջ{u��
D: ║ ���g������>o���y�
D: ║ ��RѰ�Q(D"�C����Q�"%
D: ║ ?�D��c���I$���ω��$��̯�]4�
D: ║ �����Н��^�e��δ��2��[�Kp��NwpG��
D: ║ �R
D: ║ X����6�_��NA{����o[v�t�v;g�����I~G�c���ա9�����zg���ɝl��wrv�#7�z�Ij��h'��7 ����s�骁��L�QpG3X��I�Y~�\W�3#���<��M--�6��c�^痔�]�`���ot�'�x���M�'�y�c���I��ܡ���+�ߣ{���߉����)v����^_��Ȏ�c��K|Nz���_�m|��{�?+����Ǚ����M�����W�|��*y-#J��Z�ֶ�#�
D: ║ u�3�d� �%|�Rf�j�HFȱ�0�¶6�S�(Ё)h[�������
D: ║ +=v����=$�T-�8<���"�t�L
D: ║ 9��"]mWY�V��>�R�.�&Ⱥ\Of�|�N�ҋ
D: ║ }���S��f�r��
D: ║ �i�tz�>G='<�F�G�4yPQ��a_A
D: ║ ;��4�#mgO7�+�g8�`̵2�܈.�}a�f*�Z�h�
D: ║ 2�"�X��x���"+@�c9��l{��E�Kmm3��
D: ║ df�u�<�H��l0���f܄�t=�,��G�J��������M�H�7՛��9��`p$��%�Dp]�-,bw?�wىO/-��:�/�6zL�o�ǖY��wĞ�������{y5��]���>���^+)k�<,4|O�o]R����1�n�:��>����6��R��~�/1-%ٟ�E�C]���m���Cۧ���I�{��UA��k�}�s��&�Ƥ�w���=n���'�W�P�W��?p|!�� �S��sf�i�7��.���_����k�o��4�z��:ݠT�8�G�QJ�%˶#���ٹ��S��+8IAPTES�*�#G(J�B e��H��������}��uu�nխ��݂�T�\hnҾ���F8����UH���R-��p0��݃��v2�q8|���X�L�f��*S�&�:�g���\������V.�
D: ║ e���G5�%���2��Ip%2��ۭ�WU㟄y����e�$gb��WP�A�+l�b0���J��X�a;������<D�l�(�Q��j��7vѺO4�s�c+��ְu����|6�Z���C��5�4�\ZJ�����B�����#KB5u��3�㵝_{��'x|Ք+n���0e�x!g���9���v�}��Z}�5_/X��O!|���jڧ��� �ыǥt&���ki���KXH�M
D: ║ endobj
D: ║ 21 0 obj
D: ║ <<
D: ║ /Length 507
D: ║ /Filter [ /FlateDecode ]
D: ║ >>
D: ║ stream
D: ║ A-�1l���N�Zx�4f��
D: ║ ��ŕGn)�S����G�g���l��R�ҹ���=�?�{]V4�����Vendstream
D: ║ endobj
D: ║ 24 0 obj
D: ║ <<
D: ║ /Length 16310
D: ║ /Length1 22572
D: ║ /Filter [ /FlateDecode ]
D: ║ >>
D: ║ stream
D: ║ ���������]u�r}�a> ǁ�
D: ║ 54����q��DY"v�2���|t-�/@JN@��n���]R��ME�����OD;�J�J,B��q�w��
D: ║ �&��f؇������lԃ��v���`?\�s[�}�A�E�~0p�n�k�迀4�`�л�����q������7�[H�9�����=>"5����]=��O���=qz���`F���S|��w�
D: ║ �
D: ║ r�ڔ�e�6{ѢcL�<��N{%h������N^ ��%9d#(c\LF��V�!Mٍ0y���L"��rS/VƿM�wR��I��!�����GqoU:��N>E;!F�1�
D: ║ *��I�t�J�g!=p7�b�Gc�7�]�����1��N���"�TĖ���EUY�e�J�&���8�K�����l�v����`
D: ║ �&-@�-@�"S���EP���E�L�"��
D: ║ @)���(���Y�h�f�h�f����(�e��h����h�)��(��A�h����h�)$���B
D: ║ I���B
D: ║ ($�B
D: ║ ($��(
D: ║ ��(
D: ║ e�B�(�B�(�)
D: ║ ��(
D: ║ e
D: ║ Px���������G�����(<2�"P�@!�"P�
D: ║ Q���Q��E(�2E(�@�):��(:��C������������C�V��J��.���KC�č
D: ║ 8kIΑ�ZtA�k�Y߁��v�[Ʒ��d���x
D: ║ �ړ�2�VػL_eP0`�N��j$���)�����D�z�^�)�N
D: ║ ��y�/����}ۍY,����/���_�� y�X@����I�>��8T�rǪT�>�R8J�!��M�_C[8��Q� �}�]
D: ║ }�Va�0B&���!��¨:�F�R(��UR���R��#2��"��!+�E�F�Sԧ%XA�51u�n�\홅�fz��O�wax{���Pݤ�!��.!1!Z��
D: ║ *Ac��X�#[�-jc���[fcl��Y��,�t��@U�P�� �R�� ،�-����f���f�j>m�3s�,�=�B3kv8Wv$�r�h(�a�D��9�C��rrU�K�s���U���b=<t���o0[�3e6��
D: ║ /ʼ�I2k]Tg���k\�DW��O�r��b$A��]�&{�tC�WJ!�;�^`�!V�hUyT�C���X�P#�.�dVg(r��ڈ[�SC���`����5��07�\�W�1.��N���l��6ݶ��Q��j`e�^���b�8���P2u�n����a����:g,/hZ:����X�/�\L&�Qf��H�+<)sv&i
D: ║ �A�(mb���fl��Y���iֹ�<�
D: ║ *�p�V�o�g̹�s.Ҕ���%#�W�����
D: ║ 5��p�����C�*�2�
D: ║ #�<�n宻][]g\
D: ║ ���$�G��;}9I�Ob{��%�N��D�t��^��j����f���o=�����2vf�z�B���
D: ║ �`����'=��W-��M���5��X����Em�S���6��+Kk�6����7�4G���a
D: ║ ��/An��K)Ĺ�G�"l��S�'��b5��jЙ�Hԙ��\��
D: ║ ���`�d��
D: ║ ��������6��Q2�F8�:��ˤ�i�5>��K#σ�`+O]�c]'b0��m1c98�m�$`t��>C>b?��d��ێ��G�G��
D: ║ ��|�b��6+V`A�|
D: ║ �ѵ����1�x02�ua�xaL�)�y���y�%3��kA_��Y��mc?c{Y���jI��ic>cz��/��հPG�����U��Hӥ&X�Pe����/}��O��1�[�k�M_�65хBM�Ua�G��p^
D: ║ endobj
D: ║ 26 0 obj
D: ║ <<
D: ║ /Length 618
D: ║ /Filter [ /FlateDecode ]
D: ║ >>
D: ║ stream
D: ║ endobj
D: ║ 29 0 obj
D: ║ <<
D: ║ /Length 25243
D: ║ /Length1 40156
D: ║ /Filter [ /FlateDecode ]
D: ║ >>
D: ║ stream
D: ║ �C��h�-+7=��ɟ��l*�<�E?&ģ�!�#r��x��� �3�g��뿺m���m�7f2AY^AQ-���_��ڿ�-��GH��欟����eD���B9ē�44��6V�A�!�=$AM���2�Q �KDe�%�U�������4
D: ║ ��"h+�rQ�F��!;��8�G!�O1E���V/�lȍ��X�.�v��B4���Ր�t1��ė�.H[�kv��P���� ��#Ta�O�p+�By��%HBzR�P��h9��p���N�6��?D%І��0�V�=�
D: ║ �Խ݆�"7�f>E����Y�k'�v.�jڈ�ų2ף&��D��uh��4d��<�y}�~�������=��L�M�w@{M���Q�~P��j�tG��-�1��Ǚՙ�0�(��#��>A���J�'��۹)��3�t�$�
D: ║ �f�=���
D: ║ ���h��8�9�=ÿ�%���X`E�;��G�O�����!�B���?r��_�)��S_�6�{���؎�����oǻ��Q|
D: ║ ����ʡ2����`hf1Ql D:�<#i��3�����s�x��Fw�W
D: ║ �M맴t�h>�?-��X���0 v�#sZ�1.�Q����A����ta!Ei
D: ║ �)�q��]����b��$0}h�mk�b��h�.�=})�.����Z�F��dc��ВZ�k1-��J�no�&+*�+�K�Ye��n̈́4v��+��c3�/i��u��s;sш+�|�P�
D: ║ �I!��Jy�n��a��tZF��'+%XG)P,���JIJ��C�N��Pj��uP"Ӓ�$b�ʧ.5��� ���I��Ьn�9
D: ║ � ^fs�+�s�}\AO�>�
D: ║ 7
D: ║ �~"9Nr�W����1�A�n�)K�CO�P�-�JL��(1�
D: ║ � z2�d��=
D: ║ ���!d �P;~?��C�����>� ��|�������A���'�WzG�$�ʑ�rR���?��!<7� �J�v˶�t�>l>��?�aF�Z=���OY7٫��w �?ҝ8�u�Q���U(�㐎G��u4-GA�2����z��ڝ(
D: ║ �zס����O�}�O��¿���;�+�y�P������� �D��h�U=����
D: ║ ��F�C�[���났`�Rpm;\����%�+����e�T;�y(\�6\�Ԫ��
D: ║ ���
D: ║ �*A�gUꇫ�U�
D: ║ �r7���u�J�9����I��~VNN&q����M����[ �%}϶5^��G��7���D˲�kh
D: ║ B)36��B( 䆜fC��ܗ���щ�C�N�G���1�<O1Lͩ�䩷O�?F5j.$4_�O6�- �F���R�5�75�ľ(��[!�е�WD�����|G��&E���e�@��>
D: ║ EY�<3���٥Ț�^$L��nt0^+g.RZ�)T��/�U�Ȍ̀x��x���� ����⌼������44i��=�� �!`��,�l����=�Zf�a����My�t̞>�ד��=^��/@t`�1
D: ║ �,���S0hGE���p�ԩS\�S_?
D: ║ (<VoC&&��L�1�T8GyEm��[��KE ��3&��T�3Eڤ"U�H�n35�w����֟Y�d�:�,�U�)�E�&W�oA`��θܱ����� n3�l�%>"=$���yG|��[�hH#�Փ���,~�i�3~��H/뉾���7i�O�����{�6�5�4�lS�z[;�L�RQw�V�Ӕ��z�74Ĕ�'��ʔթ�͛Q���b�'ALt����������k��x�ev2fl6�~���Gd;Ed��%�� �LٮMf�y��uo��v�oz�ȋ۷���mۯj&g1
D: ║ ����Ҟ��{������0���ß��5�?wC^���P��r^���B��_8�\XXe�L(�Q�ln.l3�-l)�4�5�1�w�/�]
D: ║ �c��Y��Tp�w���t�/]�覺q�2NE��Ƃ����ΥP��&�
D: ║ pȁu�S�K�S��KՉ*��
D: ║ �����e�2�2=Lմ�l� ����v=U�\۶�÷���K=��I���۰b֎ |��s�.k8z��@>�������ä���=��;��[�r���ä����Gt��3#jϔ��M�v�#T���t��v�_�\�̗����v�|�>� ���P�z��s�K�oA=T��U)�:��@��ā�̕u��<}���F]"&g�W�r�^�9�z������_�ۃ�o�~����q�5�t٨��r��84�b����I�=�8L*�8B�VQ�� L�E9�B.W�N'�h��P�l�H�R�O ������ŧ�5��I�d�j��v�XY<�SNg�C�����1�6��;��B?�0������pZ�f0�R�uʲ�B,kʅ�a���,=�X�Fd[*o�o��y�C��JY�W��j�v/�j�`&�^�R�ϻ7bW +�6��m9����c�H�tau��8K^�x�b�נ�1�Lq��lk�9�K7&)������^}�Pb<
D: ║ j*���mrg!4;,@ʼ��<
D: ║ Ш����i
D: ║ ~�<��J^"d�KΠl�Y8w0Hw�bD_m�V��Zy�'�����lHZ>���A$E��З�X6��k^S��1�Ǡ�$To�R�4lŎ2Rf���eHh(z���G��{�>����<s@�_+�
D: ║ f�
D: ║ f�
D: ║ `a4D!'\F-���ʍ�M�Q���.���$@a9�:>��1�Garǎ(K����y8+��q�1���3�e����r�J�v��8j�e�u��1�Sy�\���qRq� e9Q�m���7VĿ��sk�>���.��M�k����Ł;�?\���[O����۲r�1o�tƎ9�o*'��e�wAӂ�X0�a�+���ɫ���J�~u�R~�
D: ║ v���e� �£ȃ�c{ˑ{��,X�KY����%�e�����d�GnY��D7p���r��?8���[o��pF����Z�MR��W���}RZ:!��D���bJ��_�c��ǪLcSV^F�- ���$E�JGI��q]��-o��������E��B�C��g++���U��.��Ǖ�]�-�Ҕ~=6��6�AϜ��ԓe���*�{�W�be�JXĘ��$�V��Ew��s�#Yz�Iy�ʧ��=XZ?xo�.�#N=uFf4�kQ!�ƓRF���!̗�W<-�8:��y\���f�h{�-�vE;��'���*��ѓ:E�Xy�n|��Tq�D��e�[E��hI��J��TYb�V�R��<{h���8x�<�d�'|�Ɗ���rwx<N���nl(���Qg�9H����;�m�*I� .�G���n�'�DƏ/-5
D: ║ �9�X��u͊�&��_|A�R��y�Q�sB�$�q</�D!�OQ�{��/��h��b�92��y�o�{���p:e�8�ӎ�]��
D: ║ ��:l|��(����ϰ1�ac�6�-��{�E��o��Fw�u�<�E��I��,��`b�q�????x��<W��d��I!e��mD2� 1� �B�9���
D: ║ c���E>��>�X�T��bS�x�M>@����bAc@�ݓ��Щ)�W1�S��2�lcz�ʓ�����hy��g ���}�[n|�'�|�̓��_K,�k������u�_G��3U�s}xǿ��5��3|�rVo��8��/'�Z��v��v����FO�x�c=�JZ2VIs�ʏl�A��
D: ║ a�I���Q��MB��x���)�m��
D: ║ WYE��@��Ǭ���k!9���Î�!��Z�r����H�Cvh?R#a't��9;&
D: ║ ��1�AE�PY������t�AX#�(���=lmD�J J�@�Z�/�V�Km�Dd����`��W
D: ║ EP�y9<�֜tg�^��2�=�����t>�sl{�-'�+l��Hx���y��FX�s���cH���Y��Wr"���<�9��*�v��*0b0p�L\ ����*����"��Mkzc��)}�H�g�7�u���|��M�+n�9 �f_PJ�)��4S#q�r
D: ║ ��ʲ������Tڽ��i˓}
D: ║ ����Q�>���W}����%�{_�b�.��;�W��&/{�/~ش�㻞�#!c?��G�_~�w�{s����c��v���{9@ u:x�3��zl��J|)�&�wL��_4���s�w����������3Y��"I���Ddx҉��2e��)~x�4Cˣ:`��8�8� V�ڝ���"�K����Rf�a;��X�\�s������T1���/|��
D: ║ �����O��g��Ү>��ܟs�=;���>fw��l6�IX!���*6[kC)`1��"��
D: ║ !�� I�d�� �ԥk�0�e��˕��Zc!�n��@ "��p;L�<"ʜ�0�E�u���4Un�Wy��*c�P��L�8�h�q��f����Gb�zi�d~�e/�,W��xe�2Z��JFK�2�1�fRi�_�a�"�_��|Tå���I �w )����XY��1�?#(�C|;S��M(Qvy��i�<^2**���,]�1k���q{qZ6r�a" ������Ng�A�,���?�����)otC�P�ɯ�ݶj���}�;'?�Z6A�-� g��\���<zA礩+'���W���B���])!D��L�9���1��{������Ƕ:�S���_q���=��@�� "�aD�EHD�}���^ĸ緵1�s�Dz��xu[��12j��僖o
D: ║ *����/C��d���x,�2���{���8I��2�CP;
D: ║ i���RF��/� rlC��i.��no���epZ!.��ɫ�jt/s��F\+=~ }O����[��7�a��=�g�8%_���l��\2�Xy2(�W0��n�f����!�)�4�Pg%yT�S�B�T�Y�q���#G��������Y�HMLb���QLKrP�d<�GX�???? d.�A^�%<��F*5b�P�:%��A|[���p?��P��N�B�� (����E���s�y�
D: ║ :��!H]�t���hӅ�q�ѣ�c��ʚڠ�,���7ҕi�m�[�|j�̘�XP�v�n\Ju�B��x����h��[�P��j�x�ƛ�hdžm�8�
D: ║ �y�(�*�
D: ║ ����p�Iy�G`y1́���,���
D: ║ d�'H�pQ\`Q�xo"G�����>x+��pa�pY
D: ║ endobj
D: ║ 2 0 obj
D: ║ <<
D: ║ /Type /Pages
D: ║ /Kids [ 8 0 R ]
D: ║ /Count 1
D: ║ /MediaBox 3 0 R
D: ║ /CropBox 4 0 R
D: ║ >>
D: ║ endobj
D: ║ 3 0 obj
D: ║ [ 0 0 612 792 ]
D: ║ endobj
D: ║ 4 0 obj
D: ║ [ 0 0 612 792 ]
D: ║ endobj
D: ║ 6 0 obj
D: ║ <<
D: ║ /ProcSet 7 0 R
D: ║ /Font <<
D: ║ /9 9 0 R
D: ║ /d 13 0 R
D: ║ /e 14 0 R
D: ║ >>
D: ║ /XObject <<
D: ║ /img0 10 0 R
D: ║ >>
D: ║ >>
D: ║ endobj
D: ║ 7 0 obj
D: ║ [ /PDF /Text /ImageB /ImageC /ImageI ]
D: ║ endobj
D: ║ 8 0 obj
D: ║ <<
D: ║ /Type /Page
D: ║ /Parent 2 0 R
D: ║ /Resources 6 0 R
D: ║ /Contents [ 5 0 R ]
D: ║ >>
D: ║ endobj
D: ║ 9 0 obj
D: ║ <<
D: ║ /Type /Font
D: ║ /Subtype /TrueType
D: ║ /BaseFont /AAAAAA+Arial,BoldItalic
D: ║ /FirstChar 32
D: ║ /LastChar 121
D: ║ /Widths 15 0 R
D: ║ /FontDescriptor 17 0 R
D: ║ /ToUnicode 16 0 R
D: ║ >>
D: ║ endobj
D: ║ 10 0 obj
D: ║ <<
D: ║ /Type /XObject
D: ║ /Subtype /Image
D: ║ /Name /img0
D: ║ /Length 2695
D: ║ /Filter [ /FlateDecode ]
D: ║ /Width 340
D: ║ /Height 125
D: ║ /BitsPerComponent 8
D: ║ /ColorSpace 11 0 R
D: ║ >>
D: ║ stream
D: ║ ��?e��_^��3!�à¢��Y�/�1,��I��h�g��.2�[K�zq#�e���3�z6�� �ߓ<�����sS��e���~a�qW:��}Rݱ���w��E��[+m��
D: ║ =Zc7����<�a~7�v���ґ���5-�&�y�ºV�(|H=Ӭa�M����;9��;��T�ך�}���jQ-���d����t�'uD�nm0�#��r�N�n3������i���g��r�����F�� u1o׃�"�Ԉ�
D: ║ �F�!�#�ml5A��<�?�T���ѳ �(�3�q�k�i��Ϋ�u���Ce )1���\s�q��k̑���tȬǤ�N!��En$SR��H�L�n�˃ �Mg�4&j͜���, ≟�v��gL-R2�=�H�����LRv��L����L���!�1cZH;d�94��4���.d��2ePc��Rh���,�H�c
D: ║ r#��to�,f[vE��1UIaL�x,e5�6������(������S�
D: ║ L���[pe�2���$��֜��:S���RXu�wc�]Bʘ�Hg�T�4D
D: ║ ��0H�����(��%�9S����0�3�'1�v]��[�bE��.�r��D���K�2r��H$�D"�_)J�c����3U�רxR�Ԁ��eQDr��I�SG.����O��d�xR����;g�ԿZ�z�CB��
D: ║ z��\-Qaٔҗ̀�q�p�wB���4�R���U ��S8����W�1�*"��E�G��q�h��w*�J����:�����Ej��pϹ�o�S|����E6�S�O�~�7�Td"֒�Y"��R{�*�H$�D"�H$�D"�H$�D�����h�
D: ║ endstream
D: ║ endobj
D: ║ 11 0 obj
D: ║ [ /Indexed /DeviceRGB 255 12 0 R ]
D: ║ endobj
D: ║ 12 0 obj
D: ║ <<
D: ║ /Length 286
D: ║ /Filter [ /FlateDecode ]
D: ║ >>
D: ║ stream
D: ║ x�튽J�P@�-C�}�>]��]
D: ║ :�B H,��e*�+$����p��![� ��F1J� CIs�ϡg9���q�� �� �P��h6�������j�Z�(J��n�;��,��n���)���j����������D❃���b�(�O1�1e�@� b�1MӴ,˶m�qF�����R�y�d21N��Ϟ�����/$f��˛7�� ct:��A���<��$If�A�y�Pާ�$[���N�4˲�j����}SEY�UUm��뺆�$?��~endstream
D: ║ endobj
D: ║ 13 0 obj
D: ║ <<
D: ║ /Type /Font
D: ║ /Subtype /TrueType
D: ║ /BaseFont /AAAAAB+Arial
D: ║ /FirstChar 32
D: ║ /LastChar 120
D: ║ /Widths 25 0 R
D: ║ /FontDescriptor 27 0 R
D: ║ /ToUnicode 26 0 R
D: ║ >>
D: ║ endobj
D: ║ 14 0 obj
D: ║ <<
D: ║ /Type /Font
D: ║ /Subtype /TrueType
D: ║ /BaseFont /AAAAAC+Arial,Bold
D: ║ /FirstChar 32
D: ║ /LastChar 121
D: ║ /Widths 20 0 R
D: ║ /FontDescriptor 22 0 R
D: ║ /ToUnicode 21 0 R
D: ║ >>
D: ║ endobj
D: ║ 15 0 obj
D: ║ [
D: ║ 278
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 722
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 722
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 556
D: ║ 0
D: ║ 556
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 278
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 611
D: ║ 611
D: ║ 0
D: ║ 389
D: ║ 0
D: ║ 333
D: ║ 0
D: ║ 556
D: ║ 0
D: ║ 0
D: ║ 556
D: ║ ]
D: ║ endobj
D: ║ 17 0 obj
D: ║ <<
D: ║ /Type /FontDescriptor
D: ║ /Ascent 905
D: ║ /CapHeight 500
D: ║ /Descent -212
D: ║ /Flags 68
D: ║ /FontBBox 18 0 R
D: ║ /FontName /AAAAAA+Arial,BoldItalic
D: ║ /ItalicAngle -12
D: ║ /StemV 0
D: ║ /StemH 0
D: ║ /AvgWidth 479
D: ║ /FontFile2 19 0 R
D: ║ /Leading 0
D: ║ /MaxWidth 1950
D: ║ /MissingWidth 479
D: ║ /XHeight 0
D: ║ >>
D: ║ endobj
D: ║ 18 0 obj
D: ║ [ -560 -376 1390 1018 ]
D: ║ endobj
D: ║ 20 0 obj
D: ║ [
D: ║ 278
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 556
D: ║ 889
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 278
D: ║ 0
D: ║ 278
D: ║ 0
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 722
D: ║ 0
D: ║ 722
D: ║ 722
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 778
D: ║ 667
D: ║ 778
D: ║ 722
D: ║ 667
D: ║ 611
D: ║ 0
D: ║ 667
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 556
D: ║ 0
D: ║ 556
D: ║ 611
D: ║ 556
D: ║ 333
D: ║ 0
D: ║ 0
D: ║ 278
D: ║ 0
D: ║ 0
D: ║ 278
D: ║ 889
D: ║ 611
D: ║ 611
D: ║ 611
D: ║ 0
D: ║ 389
D: ║ 556
D: ║ 333
D: ║ 611
D: ║ 556
D: ║ 0
D: ║ 0
D: ║ 556
D: ║ ]
D: ║ endobj
D: ║ 22 0 obj
D: ║ <<
D: ║ /Type /FontDescriptor
D: ║ /Ascent 905
D: ║ /CapHeight 500
D: ║ /Descent -212
D: ║ /Flags 4
D: ║ /FontBBox 23 0 R
D: ║ /FontName /AAAAAC+Arial,Bold
D: ║ /ItalicAngle 0
D: ║ /StemV 0
D: ║ /StemH 0
D: ║ /AvgWidth 479
D: ║ /FontFile2 24 0 R
D: ║ /Leading 0
D: ║ /MaxWidth 2628
D: ║ /MissingWidth 479
D: ║ /XHeight 0
D: ║ >>
D: ║ endobj
D: ║ 23 0 obj
D: ║ [ -628 -376 2000 1056 ]
D: ║ endobj
D: ║ 25 0 obj
D: ║ [
D: ║ 278
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 556
D: ║ 889
D: ║ 0
D: ║ 0
D: ║ 333
D: ║ 333
D: ║ 0
D: ║ 0
D: ║ 278
D: ║ 333
D: ║ 278
D: ║ 278
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 278
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 667
D: ║ 667
D: ║ 722
D: ║ 722
D: ║ 667
D: ║ 611
D: ║ 778
D: ║ 722
D: ║ 278
D: ║ 0
D: ║ 0
D: ║ 556
D: ║ 0
D: ║ 722
D: ║ 778
D: ║ 667
D: ║ 0
D: ║ 722
D: ║ 667
D: ║ 611
D: ║ 722
D: ║ 667
D: ║ 944
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 0
D: ║ 556
D: ║ 556
D: ║ 500
D: ║ 556
D: ║ 556
D: ║ 278
D: ║ 556
D: ║ 556
D: ║ 222
D: ║ 0
D: ║ 500
D: ║ 222
D: ║ 833
D: ║ 556
D: ║ 556
D: ║ 556
D: ║ 0
D: ║ 333
D: ║ 500
D: ║ 278
D: ║ 556
D: ║ 500
D: ║ 0
D: ║ 500
D: ║ ]
D: ║ endobj
D: ║ 27 0 obj
D: ║ <<
D: ║ /Type /FontDescriptor
D: ║ /Ascent 905
D: ║ /CapHeight 500
D: ║ /Descent -212
D: ║ /Flags 4
D: ║ /FontBBox 28 0 R
D: ║ /FontName /AAAAAB+Arial
D: ║ /ItalicAngle 0
D: ║ /StemV 0
D: ║ /StemH 0
D: ║ /AvgWidth 441
D: ║ /FontFile2 29 0 R
D: ║ /Leading 0
D: ║ /MaxWidth 2665
D: ║ /MissingWidth 441
D: ║ /XHeight 0
D: ║ >>
D: ║ endobj
D: ║ 28 0 obj
D: ║ [ -665 -325 2000 1040 ]
D: ║ endobj
D: ║ 30 0 obj
D: ║ (Powered By Crystal)
D: ║ endobj
D: ║ 31 0 obj
D: ║ (Crystal Reports)
D: ║ endobj
D: ║ 32 0 obj
D: ║ <<
D: ║ /Producer (Powered By Crystal)
D: ║ /Creator (Crystal Reports)
D: ║ >>
D: ║ endobj
D: ║ xref
D: ║ 0 33
D: ║ 0000000000 65535 f
D: ║ 0000000017 00000 n
D: ║ 0000053662 00000 n
D: ║ 0000053761 00000 n
D: ║ 0000053795 00000 n
D: ║ 0000000194 00000 n
D: ║ 0000053829 00000 n
D: ║ 0000053951 00000 n
D: ║ 0000054009 00000 n
D: ║ 0000054101 00000 n
D: ║ 0000054284 00000 n
D: ║ 0000057175 00000 n
D: ║ 0000057229 00000 n
D: ║ 0000057598 00000 n
D: ║ 0000057771 00000 n
D: ║ 0000057949 00000 n
D: ║ 0000001671 00000 n
D: ║ 0000058267 00000 n
D: ║ 0000058555 00000 n
D: ║ 0000002062 00000 n
D: ║ 0000058598 00000 n
D: ║ 0000010616 00000 n
D: ║ 0000058976
D: ║ 00000 n
D: ║ 0000059255 00000 n
D: ║ 0000011206 00000 n
D: ║ 0000059298 00000 n
D: ║ 0000027617 00000 n
D: ║ 0000059709 00000 n
D: ║ 0000059983 00000 n
D: ║ 0000028318 00000 n
D: ║ 0000060026 00000 n
D: ║ 0000060066 00000 n
D: ║ 0000060103 00000 n
D: ║ trailer
D: ║ <<
D: ║ /Size 33
D: ║ /Root 1 0 R
D: ║ /Info 32 0 R
D: ║ >>
D: ║ startxref
D: ║ 60191
D: ║ %%EOF
D: ╚════════════════════════════════════════════════════════════════════════════════════════
D: server contacted and has file
D: file download: 2048 of 103688
D: file download: 4096 of 103688
D: file download: 6144 of 103688
D: file download: 8192 of 103688
D: file download: 10240 of 103688
D: file download: 12288 of 103688
D: file download: 14336 of 103688
D: file download: 16384 of 103688
D: file download: 18432 of 103688
D: file download: 20480 of 103688
D: file download: 22528 of 103688
D: file download: 24576 of 103688
D: file download: 26624 of 103688
D: file download: 28672 of 103688
D: file download: 30720 of 103688
D: file download: 32768 of 103688
D: file download: 34816 of 103688
D: file download: 36864 of 103688
D: file download: 38912 of 103688
D: file download: 40960 of 103688
D: file download: 43008 of 103688
D: file download: 45056 of 103688
D: file download: 47104 of 103688
D: file download: 49152 of 103688
D: file download: 51200 of 103688
D: file download: 53248 of 103688
D: file download: 55296 of 103688
D: file download: 57344 of 103688
D: file download: 59392 of 103688
D: file download: 61440 of 103688
D: file download: 63488 of 103688
D: file download: 65536 of 103688
D: file download: 67584 of 103688
D: file download: 69632 of 103688
D: file download: 71680 of 103688
D: file download: 73728 of 103688
D: file download: 75776 of 103688
D: file download: 77824 of 103688
D: file download: 79872 of 103688
D: file download: 81920 of 103688
D: file download: 83968 of 103688
D: file download: 86016 of 103688
D: file download: 88064 of 103688
D: file download: 90112 of 103688
D: file download: 92160 of 103688
D: file download: 94208 of 103688
D: file download: 96256 of 103688
D: file download: 98304 of 103688
D: file download: 100352 of 103688
D: file download: 102400 of 103688
D: file download: 103688 of 103688
D: file download was a success? true
2 个解决方案
#1
2
You can see the following link:
您可以看到以下链接:
Set appropriate headers and don't forget annotation @Streaming. It works for me. I tested it with different types of files and it worked.
设置适当的标题,不要忘记注释@Streaming。这个对我有用。我用不同类型的文件测试它,它工作。
Retrofit2 - How to Download Files From Server
Retrofit2 - 如何从服务器下载文件
#2
-1
I was using an old version of Retrofit and Okhttp. Once I updated to a newer version it worked.
我使用的是旧版本的Retrofit和Okhttp。一旦我更新到更新版本,它就有效了。
#1
2
You can see the following link:
您可以看到以下链接:
Set appropriate headers and don't forget annotation @Streaming. It works for me. I tested it with different types of files and it worked.
设置适当的标题,不要忘记注释@Streaming。这个对我有用。我用不同类型的文件测试它,它工作。
Retrofit2 - How to Download Files From Server
Retrofit2 - 如何从服务器下载文件
#2
-1
I was using an old version of Retrofit and Okhttp. Once I updated to a newer version it worked.
我使用的是旧版本的Retrofit和Okhttp。一旦我更新到更新版本,它就有效了。