I'm trying to 1. download a ZIP file in Groovy and 2. unzip the contents of that file. The code that exists currently is as follows:
try{
URL url = new URL(SOLIDURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Authorization","Bearer "+SOLIDpassword);
conn.setRequestProperty("Content-Length","");
conn.setRequestProperty("Content-Type","application/json");
conn.setRequestMethod("POST");
conn.setDoOutput(true);
OutputStream os = conn.getOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(os, "UTF-8");
osw.write("");
osw.flush();
osw.close();
os.close();
println("token: " + SOLIDpassword);
conn.getInputStream();
BufferedReader bufferReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String output2;
StringBuffer response2 = new StringBuffer();
while ((output2 = bufferReader.readLine()) != null) {
response2.append(output2);
println(output2.toString());
}
println("Output:-" + output2.toString());
bufferReader.close();
// printing result from response
println("Response:-" + response2.toString());
} catch (Exception e) {
println("Error:"+e.getMessage());
println("Error:"+e.printStackTrace());
}
(SOLIDurl/SOLIDpassword are defined earlier in the code.)
When I run this on a valid URL containing a ZIP file, I get the following output:
Response:-PK�;Uv��4J -FIGS_Payload_19015_8_600_20220819_023031.json�m�\Gv]�W�W�z�E�HC� �ǒ�p�#�L{�T��!����U�f�[ݷn��u���q<����V��;O���o�������O?~��_���?��Wg��~�����/_�������������m���~|��>����o����_��柾��_��_���7���g�����������W�~��?���~���v����_���������͏����O���o��q��؊��_~�����������7?���o���o�������F��~��/y�����+���������~��;����g���?�����b�ڎ|���~���_�y�S���~��O~����p�������g����ۿ�Տ_���n�ɟ~����َ>���o����˛����v��K�ǟ�t�W|���o���IA�� o��x��������4�}=y��������͗;:���?�gJ�����������_��������ի�߇��^~����b\���=�ei�2� ��!�u[f5!��Of=!�>$�j�l&d6�dgm�� ��:���D�bB�b6:� �۱�?'����n���5W�������W�?|���W�<:��?��-����������9{|�Z��o�?��������ݫ���n>����jq������X���>��/�|���>�r�O�z��L|���y�S��֍�j}�C�of��֍o����\��Em���9���<���?��75�V�W���_?�|+���G|���=����-�����|���W�>9X��eT�c�ϟ|���GO����чx~�C�֏/W������������w����ZE����V��<>xO�*z�|����/���G/�z��g���/�|��㧟�x�����G�}�j�Go��-�O�n�7��i��^>����aC��c��y>~���Ϟo_6>��g�rP��?��-����7�N��E����b��ގ�V7u6}0v��k��u����j�6}06=�f:m�`�T����.'d.��֮&d�f�k�?ۃ�v06坓�,w��ѱS-�b�:(3;��9�N���E����?ϛk���?����ɷ��X��f�9X8���e��C�g5�O���6q����A���[���*1��v����!�o�1�|��_=���/��3�>���'�}���'���˭k_��f�?�.k,j>����Y>�-Ϟl��/�~�ᣏ^<��ӧ��ӧO����߯��G뭃�y�����ѓ����4�>����/�-��ǟ|�e�������>���>��32t�ٶ���_|������g���ѓ����}������1=;{��Ŀr����'����nU��ї/��bc1���Տ>�������=�y6�Y^>�S�~S�>��է��~�O�8��1}�婟�`�`��3l\]d�ն�u��-�2?�J|�䋧Ϸ�����'��իG�>�b����'/����ӷ��w�_���������/2T��_m ��bJz�]��/'�j�Pd}?z�d;C|���n]��&����ѧۿ���m o����������6'&��o�3�B��p�$��?����z�������t[ޯ����ᣋ�h���{���濻?�����_=_}���?�<<z�����O^�����Xn����N�%���ǟ��=(w]����-zN�|���Ϟ<�~}�?�>��_�u�r�D�� lh��|��?{��M���O�����������뛩kyx]�X��t��O:Q�g��������|;Ӽ�"�>߷�]������ӧ�����sv��Ó��g=���O��,f�D�ǫ�'�x����|���'�d�;�gX�a��~�T�˦�vjݜ�q��~����'�k�����R��g7�!W��Ww{�F'�]��;_���=]jsu�98>:��f=�F���n7�F����H����vU�Gg�Z��vV�GO�Z_^���� �Y��3H-�.��.��$��;�Aj���Fg��v�&�jtV���8�A��|���3|��v�Gg�Zm&&����R˫��Id0:���j��>�Ajy1QW��ӥW�z��3Hm�� ��A�~#a|��R��FU�������ӥ���#�FFO���j�۶;0<�Wx�y4���ad.�Lg��#k3V�#�3|����`��/�ls>�Fg��M�,��Q�Hj�Y�L�#���E��t����/W#�FFg��_.G�����Y-6��'S���W-��q�G�J�����;2��:2��vdv�Ǝ�;2vd��ؑ�#cGƎ�;2vd��ؑ�#cG���\�ޑY�֑���#��4vd��ؑ�#cGƎ�;2vd��ؑ�#cGƎ�;2�uG����)�~��:2�䕣�Z�Ԓ��<��%O-yj�SK�Z�Ԓ��<��%O-yj�SK�td�N�ȬO��\�ۑ�};2fd�Ș�1#cFƌ�32fd�Ș�1#cFƌ���9#���:�ud6'udn>�l�ݧ�#cGƎ�;2vd��ؑ�#cGƎ�;2vd��ؑy�;2��;2�ud�vdv�Ǝ�;2vd��ؑ�#cGƎ�;2vd��ؑ�#cG���,O��\�֑Y�ۑ�};2vd��ؑ�#cGƎ�;2vd��ؑ�#cGƎ����#�:�#syZGf5oGf�i��ؑ�#cGƎ�;2vd��ؑ�#cGƎ�;2vd�������촎�z֎����#cGƎ�;2vd��ؑ�#cGƎ�;2\G�-��\� z#j0�p�W���b���/�K����W�]m�������R��Մ�`t���ry6�W��=�e�������/�FO�����xƥ�����������ͬ͟͟�Oc�����?6l�����c���͟�zxy9��=}���،,�GFO_�m�'���诪Mr��\���m���T��vt��ˑ����R�ՄT��.u�XMHF���.����Aj�����Rg������R������R��ăi0z����r}Xj0:���r��`t����/p0:�/�j1������S���������sH]�|�����?�˩g�`t���3p0:��b3���.��<���Fg�Zo&XFg�:��`5=]j�������R�ˉ�j0:���rb���*�E�ۥ���S.�����b��nWWc���ч�����A���VϾ���=�U{�xq5���3����Ĵ8��Q{6�P�� �\M<��s<�7�����p����ί&&���R���d?�c�ZO��kt���|���_�\u~�\uʕ��`����Rùʹʹʹʹ���U'�U�檋Y��O�\��u��*�U��u���s�ⴹ�rj�i��V�����[���N��N9�s� f��~�s<����h��U��ӯ��:i����]��4�U��\W��r]�[ZW-'�U��is�bֹ���8W9W9W9W9W����_v�ܜ6W�����O�\�\�\�\�\����N�����y_y�i����������~Ss��g����������O�\�6x�\�ݦ<2:�����e5:C8��j�|i�Α�YL�^�yx�����R멫��3H-�n��� �8���jt�/��c��x;:C]�����8���q��9��O]A8��i����CO���9�YN�s;:�q��W�<�;:�q�����s�����F�vs1ǖ��c'��`�����W����/ۉb��~���2�ֿ6V��G~�� ����]-#�7����f�m�чW��?�3M#�3�.d����чIm�����Cw�����~�7O�ݥ�Ww=����~������j��_�~>kg�������g���|]��>k}��~���_;�5U�S�)��`�g�/O���k���ٳ�W�kg�f�x��'��Y��+|����Y��!��� :���O0۳��*�g��Z��>k�᚛S�X��`�g�/��Y��g��ڇ�N�����d'�潦�����uo̽����د�_;���͉��y�no��g��{�Z�O�<z0:C�f�&�X���A��7x�{A���}�8X�(�������]l��;\,ǂ�#���0ζ�3�FO�Zm�'~����֛ V����.�~�5z��6/9!5}��iʓ���Ŕ�s���=�M��j5�D<��p�oݝ�,t��l���{o��A��b|�P{�Z��f������N�����������?���]�9>�� ~���?i|��O��'��I����w��=<-~������A������������F~#��)���[��^ <>x�R���5A����?����F�y���ٜ�*��O0[�`������[c~?>x��w�]�[ŏ-i'ӣ[n�����'~��7���2Go����`�����u�����is�zc�i�;����c��掋w�n^��ij�����8��|6�{3��'�7�������O�~ψ�����VS������]=�[�{�)O�`[^Mm�F�����n��~pb|p�7������a#�3tL��p����w��N���>uq1�l<}��v ��gX����<�Ww��>��?��R��ǖJ��3|w���^�{j�O?^�9�x��'��,�������-���-��{�!�>z}��ч���_lWGg����϶����n�d����?���ʦ�+���Ѡ����1���؏rdt���GF.u��g���.�Z��GF�eN�Z��j3v����<E�������o�Tԛ՝�������A�{�wۜ���mD��jk0x��l|�a��u/�:>x�_�~�E2<��<;��<�/��#3��:ۜX<���1t�˱e����%���ΰY/���/���.�?FO/�{M������_i|#��K��oMܜvk��'�m���^���w��_���}��2G[�A>lyy��4�ߘ�������c�{����c�/vq�&��H���N�7摼���o���9�r8�Z����]w`��ݧq���V��7�=}���ͻ����nn�^���džƨ����/�:Qd����(:�ǰ�ZN���34iF�FFO������`t�6�����><_>(� ���]�Q���ӿ����T|�FO^��v��t�srH�v�d��}H�����/��T�x0z_�}o�}�}`��ω[����b80:��1y��&I���1���>�j0:���ڏ���WM�\�)uv9�s1=�g��d}�_u�ζ�!=��X��ٱ����ru�Z�NY��/{�Kj����s������Vw�>ョO۹tB���Q��������,oj#�F�fD�������i<�,��'���_�,������`�r��ƃ����#�9-^'��C��s�Я?�/�C/{��ېz����f����7FOﯜ_^�H���0y�|�����q�t�m}N��{"����x߽����Rg�GsI��,��^]�3H�_��Fg��,G"s#�3H��(wdt���/�F����9�헧\�z� f��~�]�|��B��U�3�(�*�����Ŀ��/��Ѽ�O��?췊�����/z7�>��6���h�-����4��߿�zZ��f�m�w�ir��I�;�tr�����%�i��[�>8-#�w�-���#湵�wRO� �Y8�N����*�� �+��,on�}pz{a��f��w� ��n��pz�I�p�іS� ���h�)���n��p}č��N���іS����Ӎ���u���}�-�����y���c��F�N���#�7��~'����h�)�堏�іS� ��n��pz{.��t�-�c��`n���p��O�-���//m9%�(Q�rJ8Qy�ҖSZ疶�NXn���p}����> 0�\��S� ���z:�F�m=%����ҖS��J[N',oT�r8ay�ҖSꗗ��NT���p��y�|���J�zJ|9�#�5���d�軘�7*m�{�8]�y�ҖSZ?���NT����p�|Di�)�D����N�:���p��F�-���#�����wE�疶��p}�y�F=Q}�Ҷ��G�?���N���=��s�'�����؇���F=��'s�N��0����s�9',�\���d�K�J[N '��[n���\s�N��3�����[n�r�G�[np�'s�9',�\���c�.��ri�)�D��J[N '�_^�rJ8Q>���p��F�-����-m9���ri�)��s��:w�]Q���m=%�#an�QOTߨ�����Q�O�-��8?�[Ο{Xn�����؇5�ܨ'p�dn�� ���#an9��K[��s��Qi�)��=sˍ���kn�� �{����\s�_�s�N��dn9��K[_~���[.m9%���Si�)�D��K[N '�G���NTި��p�ֹ�-���[.m9%�#an9\��+j?������#�-7�������=j����p�'s��s�-����p�������-78�>��r��#�-眰�ri�#�u.�7*m9%�#�gn��7�s�-�s����'p?��r� �-��>"��O��z�r˥m=�8�r�m9%����#[N '�_>ЖS� �m9%����#[N 'h�;ЖS���-��p}���l�{�]A��m�)��sˍz��Fm�)�{���#[N 'p~2��?����#�zJ8�}Xsˍz�O��#an�� ��sNTny���HֹP�h�-�����-7�F�~���'��[np�s�-7|9�#�-78����[h�ˏqZ���ҖSZ?���NT����p�|Di�)�D�J[N 'j�[�r8a��ҖS� ���u��sK�zJ8�>��r����Qi[O�ߣ��J[N 'p~2��?���ri[O '�kn�QO����r���Ö�Ͻ���-m9��<li�)�D��ҖS�',m9%��~Di����5�>�ҖS� {�Zi�)�D����p�ާV�rJ8Q��(m9%�������N���^����w���9'�}j��s/Y�R�A)m9%�#�g6�a�S+m�)��=���z�ާV��S��A���8?y/A� {�Zi��;�i�����-���~*m9%��~yi�)�D��ҖS� :O8ЖSZ疶�N���h�)���%����-m�)���%h��7*m�)�{��Si�)��O����[.m�)��a�-7�%��1��ޛc6��KP��O'�^�ҖS� ���<l�D��r�N��3���_n���Aa�� ����朰�t�����%���ҖSZ?���N����-���#J[N '���-����-m9��<�#[N '�G������-m�)���z��F�m=%~��*m9%����<l�����U��S� �Ú�m��~��'�G�[np}����[.m}D�Υ�F�-�����-7�F�~���'��[np�s�-7|9�#�-78����[.m}�1N+0�\�rJ8Q�ҖSꗗ��N��(m9%���Qi�)�D�sK[N',�\�rJ8�>��r���}W�~ni[O '�G�[n��7*m�)�{��Si�)��O����[.m�)��a�-7� \?�[np}���'�G�[�9a����G$�\*oT�rJ8�~��r�o��[np����'p?��r×�>��r�8?�[�9a���֗�s˥-���~*m9%��~yi�)�D�����7���}WTި������-m9���ri�)��s�����K�zJ8�>��r����Qi[O�ߣ��J[N 'p~2��?���ri[O '�kn�QO����r��#�-78�>��r�_���-7ֹTި��{ '��[n���kn�� �{����\s�_�s�N��dn9��K[_~��98?���N��T�rJ8Q�Si�)���O�-�c�.�s5�-����+m9%����ҖS��-����-m9%��uni�)����)m9%�#Ṛ������Qi[O '�Gx��QOTߨ�����Q��ҖS� ��<W�?��s5�m=%��>��j���<W�����48�>�s59'�\Mi�#�u.�7*m9%�#�繚F����\M���<W����[n�r�G�[np�'s�9',�\���c���ɜQVG�`��������-m9%����ҖS�y�-���+m9%�0�g�<~��%�+/m�)��s�z���K�zJ8�>�\y����^i[O�ߣ�K[N 'p~2W�?��\yi[O '�k��QO���\y��#̕78�>�\yc?\?�+o�s�<Xi��N��3Wި'p?�\�w9'��+op�s��地\yi�#N��d�<�',W^���NXh��rXIX\٬rLj��R� A��|rL�L� A�X�N Q�d��1!�)�CN A��&�cB�S0{��?��c/m�7� Q�I�36c�:���SB�z�\qJ�r&�SB�S0K�z9j=d�8]�B���1!�˙N Q{�f�SB��3-���X� �n�r&�SB�<d68$D�MG��� ��g*���m�>���P[N 'dbO[N '���i�)�����pB�{�r81��=m9%�#a�;_?1�=m�)���ލzB�y{��S����=m9%�����w��c�{��S� �Úo��~2���S�N��0����O&��\$�����K8�~ϴx����\3�N��39�������N�{̅��w�ra{��S��\X������q��Wa.�ʼn��s����p}���F=Q�e4�{�>�\X���sa=�G�G�\X�8?��9Q���� '�k.�QO���\X��#̅58�>�\X���'sa�u.��`sa����̅58������9�~�\X���뽢_�omp�'��9Q����t�K[N 'j�T�rJ8Q��ҖS��-���7*m9%��uni�)���K[N '�G�[����-m�)��sˍz��F�m=%~��*m9%�����r���r˥m=%��>���F=��'s�N��0��C��-m秄u_Xi�)�D�[�r8a�Ö��N����-��u?li�)�D�[�rJ8�~�s���9��m=%���h�#���s9'����Ͻc��s{�rJ8Q�'����o�+�_�9�'�Gx�ljz��z��u��Z��s{�����#<Ш'j?�s���#<��D��<��{����z����s9'�����<��a=Ш'p�dn�� ���#an���������:����~/��=sˍz�s�-78�~��r���kn���Aan�� ���-眰�ri�ˏq�s˥-���~*m9%��~yi�)�D��ҖS����N�:���p�r˥-���#�-����wE�疶��p}���F=Q}�Ҷ��G�?���N��dn9�a��Ҷ��q��G��-����������`��Ӷ�N�~���� ���:J�s���K��]� �g����~Dl������xߨ�S���>yi[O '�>l�����~���'�G���������'�G�����/�~{×��q��� ���oo�����78�}X� �8-θ�����N��4ЖS���j�-��u��#[N '�G��p�� �rJ8�~���r_N���S��A��S�u.8?�W�9Qy偶Ͻc�\v�-���~*m9%���#[N '�G���NP�e�-����-m9��<�#[N '�G������-m�)���z��F�m=%~��*m9%����<l�ܣ�m�)��a��6� \?���'�G�[np}����[.m}D�Υ�F�-�����-7�F�~���'��[np�s�-7|9�#�-78����[.m}�1NK0�\�rJ8Q�ҖSꗗ��N��(m9%���Qi�)�D�sK[N',�\�rJ8�>��r���}W�~ni[O '�G�[n��7*m�)�{��Si�)��O����[.m�)��a�-7� \?�[np}���'�G�[�9a����G$�\*oT�rJ8�~���wy���5����=s�N�~����[.m}D� ���-����K�z:�i�K[N 'j�T�rJ8Q��ҖS��-���7*m9%��uni�)���K[N '�G�[����-m�)��sˍz��F�m=%~��*m9%�����r���r˥m=%��>���F=��'s�N��0����s�9',�\���d�K�J[N '��[n���\s�N��3�����[n�r�G�[np�'s�9',�\���c��`n���p��O�-���//m9%�(Q�rJ8Qy�ҖSZ疶�NXn���t�����h�)������NP�|�-����h�)�D�#�r8Q�����N��3��k\WP�h�m=%�#�g>�QOP�h�m=%���#�z��m�)�D�#�r:���G��p��O�-���//m9%�(Q�rJ8A�����N�:���p��m9%�#�na?b�]Q���m=%�#�n�z��F�m=%~��*m9%����{���u��#�zJ8�}Xsˍz�O��#an�� ��sNXn����:�����N��3��������#�gn�� ��5���堏X�#rN��dn9��K[_~���[.m9%���Si�)�D��K[N '�G���NTި��p�ֹ�-���[.m9%�#an9\��+j?������#�-7�������=j����p�'s��s�-����p�������-78�>��r��#�-眰�ri�#�u.�7*m9%�#�gn��7�s�-78�~��r���kn���Aan�� ���-眰�ri�ˏpZ���.m9%���Q���N���K[N '�}ԥ-���>�ҖSzui�)�������p}���l�{�]A��m�)��sˍz��Fm�)�{���#[N 'p~2��?����#�zJ8�}Xsˍz�O�CN.;���p��m9��<�#[N '�G���N�>ai�)�D�#J[N 'j�����r�G��m�����<lΉ���}��t�aK[N 'j�T�rJ8Q}�ҖS��-���c)m9%��uni�)���aK[N '�G������-m�)���z��F�m=%~��*m9%����<l��[�~�����UO�-����J[N '��N��+m9%���I���=��Si[O 'j߽��p�O��.�>��648�>�sj9'�Zi;?%�\*_^�rJ8�~�sj�s;�V��S� �{�Sk���+m�)�堏�Zc��O�S�9a��J���1N�;Q�~yi�)����9�����~yi[O '����D�J�zJ8���xN-�'�Zi[O '�G�[n�x塀�'�G�[np�72�����=�������r� �-���<��a�-7� \?�[np}������VO{��O '�����pB|����N�9�=m9��s{�rJ8!�=m9%��|Ğ��N���#��=�{�m=%�����k�x����'�>K�N�}��#rNؽ���8a����N�߳�?��{ J�zJ8�~�~D����y/A×�>�{ ����{ rNؽ���8Ɖ:��yϬ�.�{#J�:J8Q��ҖS��(m9%�(�W�rJ8a�{#ޤ~|�]Q}�Ҷ�Nؽ�-���#�7"�a�F����p}���F=Q}�Ҷ��G����N����s˕������#ֹ{�r81��{�rJ8����o��`������c��Zr?#���;���m%����-��u�Qi�)��M�g��7��'�Ӷ�NT���pb������A� �����߾�m=%�#�~{����^i[O'f�}O[N 'p~r�=�1��{��S� ��z�[�������58�>�{�y0�Ͻ'�Ͻ'0��s�� �+{e�'xN��+�i�{�J�un� �{�_٨'���lp���W68��Fx����A�y�'p~�<M����m�a�|���F��:�YڮsN�~���F=��5\�68����s����s���s����un� �7�����8�� H�aK[N 'j�T�r����iJ[N�8Q{O����3.��Ӕ�u�p��+�-���W.m9%>�:OS�rJ8Q}�ҖS�����p���-��v�Qi�)���5j�s��^i[O '�=B�-�����G��GX��S�#��ri�)��s�w/�E�+*Q��Sҏ��-��8?y�^�����+m�)���>�}�����/��������ϭQO`��S�G�������w�� \?yA� �����{I�:GX�rJ8�����r0g�}N���>�'0g����/}��48���䜰�J[_~���wj����p��O�-���//m9%�(Q�rJ� ��=J[N�9�=�-���c93��#��ޞ���p�c1oԨ'0gi��� ��X�#a��q�\?�ci�a��>��~/��=s,�z��0����=s,N�=�X���X����K� �_����G8a���` + ����JLj��Z� A���JL:�1!h��)!�Jo�� QN���RB��7ń(���7)!��c�8�r�֑y�5�4 Q1c3�1!�sj�8%D�����(�`�8%D9�ĩ���C���+�1?�������jf8%Dy9��)!j�՜p�)�`B8%D�Cf�CBT0�Tpv!A�����!7གྷ�m����]e�{NK[N '��ҖS���7�i�)���i�1���z�Ri[O '�G�yl�uo{i[O�ߣ��R�rJ8��)�����/��������z�O�"�#a:�� �f$sN�{�K[��s������N��35����S2;���=�N�~�9ʆ/}�i�'p~2S�s��\���c�v�����-���~*m9%��~yi�)�D��ҖS����N�:���p�r˥-���#�-����wE�疶��p}���F=Q}�Ҷ�>���T�rJ8�������K�zJ8�}Xsˍz�O��#an�� ��sNXn���',�\�rJ8�~��r�o��[np����'p?��r×�>��r�8?�[�9a���֗�t�K[N 'j�T�rJ8Q��ҖS��-���7*m9%��uni�)���K[N '�G�[n�����m=%��z*m9%�(_^�rJ8Q����p�|yi�)����ҖS� ���ܗc� K�zJ8�>��z��sK�zJ��+m9%������s;OX��S� ��z�0��+�<ai[O '�G���N��(m9%�j�T�rJ�ݩs�-�����<a����m=%�#��y�F=�9K�6ֹ���<a�8?y�0焝',m}�N�3�<�#[N 'h�4ЖS� ���p�|�#[N '(o4ЖS� Z���p�r�m9%�#an9[�^W�~�#�zJ8�>��r�����#�zJ���4ЖS� ���-��=*�<ж�N`��r�������'�G�[np}����[h�#�u.�7h�)��=sˍ���kn�� �{����\s�_�s�N��dn9�D����c�`n���p��O�-���//m9%�(Q�rJ8Qy�ҖSZ疶�NXn���p}���p�������Ҷ�N��0�ܨ'�oT��S�����ҖS� ���-��=,�\��S� �Ú[n��~2�ܸ�����S��>j�ON�}a��rN��jJ[��p�'�O��,����~jp�/w�����y��v~J8Q��ҖS� ;OX�r8a� K[N '�[�rJ8Q9�ҖS� �{�'�}9v�����ė�>��u.8?y�0焝',m�{�8�ޱN�XJ[N 'j�T�rJ8Q9�ҖS��-��u���p�ֹ�-��v����p}�� �u��sK�zJ8�>�<l����Qi[O�ߣ��J[N 'p~2�?���m=%��>�y�F=��'�68�>��r��#�-眰�ri�#�u.�7*m9%�#�gn��7�s�-78�~��r���kn���Aan�� ���-眰�ri�ˏq�z�gut��K�:J8Q��ҖS��(m9%�(�W�rJ8Qy�ҖS�C���NX����p}���|�ĭq͕��p}���'��W��O�ߣ�K[N 'p~2W�?��\yi[O '�k��QO���\�w9'�G�+op}����+/m}D�Υ�`�-����̕��=,W^��S� �{�����+o�r�G�+op�'s�!��;������ '�Q�r8a��ҖS� �G���NT?���p��^i�)��=��/���m=%���#�\p~��s�ι��Ͻc���9�ҖSZ?���NT~���p�|Di�)�D�*m9%��uni�)����.m9%�#�9�p�������Ҷ�N���u����Qi[O�ߣ��J[N 'p~�u����Q����p����n��~�u��#�-78�>��r� �-��>"Y�Ry�ҖS� �{�}#p?��r����-78������������r� �-������[.m9%���Si�)�D��K[N '�G���NTި��p�ֹ�-���[.m9%�#an9\��+j?������#�-7�������=j����p�'s��s�-����p�������-78�>��r��#�-眰�ri�#�u.�7*m9�t�XJ[N�8Q�=��y����u�p�ַ�-����-m9%���Qi�)�ysFo����3*m�)���J[N�#a�(�a9�Ҷ�N���Ѩ'��W��S� ����N��d�(�a9�Ҷ�N`֜Q�����9�'�G�3jp}�9�F\?�3j�s��Qi��N���~�F=���ޏ���=�Glp�s����A���N�����9',W^���c���ɜQVG�`��������-m9%����ҖS�y�-���+m9%�0�g�<��_���Ҷ�N��0Wި'j�������#̕7��땶���=j���p�'s��s˕����p�������̕78�>�\y��#̕7�s������:�ʃ��~/��=s�z�s͕78�~�\y���k~���Aa��� ��̕眰\yi�ˏp�B�&��J���f�cBP�ܔrL��cBP��drLZ�z�uJ�$�F� QN�r���{Uݧhp��#�m!��W�}�F=Q��m=��}�ҖS� ��ܧȟ{�>Ei[O�8���UJ[N 'j�T�rJ8Q��ҖS��-��u.���p�ֹ�-��v�Ji�)���5�u�Ν����p}���4�������=j����p�'�Wɟ{��*�m=%��>��>l^O����U������'��������RB��v��d���(>�5��(��C�<�"� Q^�tJ�:�i�?%Dy9�)!꼦Y��mSN�J�����������Wt��.�6������qB���}qIE���¾��"R�nѾ��"R���TD ��K*"����%��b��K*"E:��d݈�_�r���"R���,L���>쾸5y?���y��k���"�)O�4H1Gb��}�E���Y�NM��)3�R�����R������G��|�pg勤����~)����������)��y�C����L#zj�:��TJ�zS��Q)!�L��P�)v�����5�M����~S�/�K���Ha��TB�K����"R�~S�K*!�%XJ\R)l��%��,%.���(L�4�S\��ĭ�����),��`)qk*"Ez?,���,%nME�H�g��SSX��ĭ�ȥ����-;�)r���)��}q�~GIa�$��y�b�[K)l�[⒊Ha�%.����J\R),=V⒊Ha���TB��Q��%�"�7*6�S܍�%nME�HGa�SS\'�<z~O��~a;�%��9O�Go��G/qk*"Evhͣwj�\O�G�"�y�)�Q�G�tr=��|g勥�J\��"��y�NM�{���;�H�g�C���5��q餣0��!E�S����<z��ҏ���R���ZZ��y��V�qIE��ݎ���"R���K*"E��⒊HQ�����RX} .���(̣7�SX} nME�HGa�SST�o nMEޏ�A�K*"E�S��O?,�>��"Rd��<z�����y�)�Q�G�"�y�Ξ/��2��Y�r���I��/��~��;��=_��R��3��!E���G�t�Q�GOS���#����Ha'J\R )��#�K�()����p~Z�7ٗ�����ʗ��"R�=I%.��7Gyr �#s�ea�Ζ�5��n5(qI%����K\R)�Qxr�1Oq7ٗ�5�"�':5���Jܚ��v�X�K*"E�S�h<����Kܚ�H�ZOtj�\Oyr�C�t��"�':�tr=�Ɂ��K����/"Ez?Otj�����#���<9�!E��zr���IGa�C���̣7Hqy�ץ%��'ܕk�̣�����V�%.����Q⒊Ha���%�ABK����"RXo��%�����%.���(̣7�S\�ĭ���(̣wj����5y?l��%�"�);����G/qk*"Evhͣwj�\O�G�"�y�)�Q�G�����)�蝕/�+q�_D��~��;5E���G�"��y�)r��<zǥ���<z�9O�Go����%�K?J��5=���G/qk)"��xK\R)l���%��<_�K���r��Cԝ7�݆��5u���̡�����#�Z�HaoV.qIE�(w>�TD�|%.�����K*"����%����E�w�]Y���h������H���Ӣ����}%nMEޏ���%�"�)O�6�~�iс�5�";�������h��(<-�!E:O�v�|����E;+_�l�#\��"���E;5E��zZ�C��~��"�|=-�q餣�h�9O�Go����%�K?Js�fg�ZZ�y���"R\=�G��c�/��(qk*"�y��TDK����"RXo��%�����%.���(̣7��G/qk*"E:�蝚��}%nME��A,qIE��y�<z�����Kܚ�H�Z�蝚"�S��;�HGa�C�t�ѿk�O��)��R\���~)���x����k�C��~��;��=_��R\��u)r�2�ި).�^���QRX��DfXK+2�^��RD["Rܓ�<z~r`�ea��ĭ���+qIE���D�K*!���K\R)�Q��j8.�^��TD�t��Ú�~�'�l�_�����(�7�闐¼�#\R)�]�z����~qk*"E:�_����ށ�5y?*=6�TD���<��x�ag��TD�ڝ�K*"E��<��y���³�R���,b�CK��<��Y�R'�:����<�ة)*�7��"R���,b���=_�"v\:�(<��!E�S�El���"�uGIas�����.���qk)"��xK\R)l���%��<_�K*"���J\R)���G�O\�y���"R��0�ީ)lW�ĭ�c��zj .��v��T�nr=5��"R�Il�S͚��vq=�#����z�I�t��:���]\O5k�t�����r.q]z����C���"R�<����ӏ{�h�[S)�C���NM��)��vH����R���|o�CK��<��Y�bo+q�_D��~����������=��<U�>�R\߯�%�"�=pf�/�q}���"R�[���uj�|G�}�)�Q���"�}�Λ,���}��������/"Ez?�~��"��k߯C��~���!E���{�:.�t���!E�S��� ���7ץ%�Փ�{�ZZ���ĭ����-qIE��ݎ�TD�����"?5����S�%nME���D�K*!��CQ⒊H���{(�wE�[S)�QxE���~_�[S���vK\R)r�2��x�qy���"Rd��<z�����y�)�Q�G�"�y�N/�\O�G�|��X���"R��3�ީ)r��lR���̣wH�{���;.�t��;��y�<z��G/q]�QR��p_*���G/qk)"��xK\R)l���%��<_�K*"���J\R)�7Q�JHqy��TD�t���).�^��TD�t��;5���Jܚ����3�����}Y�<e�A�ˣ��O��١5�ީ)r=e�C�t��;�"�`�o�֡-qEB�K����"R���L�5�~\z�ĭ�c��`������H�y����5��3�̃���]h�(gD-l�Ō�Б�����Ō�\SF9#�3�/�Q� �E��������bF�|d�(e�E��匰�� ���>2;3�<�������2�u��ț+�5,��ʜ�뼭2f���zOe��uf�cF�>����{c��\q���L���8�Y���Q.�݆��t�{�{9��I%�I��y2��C���)�BtH�'��EtH�7Rڑ�t�Qؗ�"�)�R�y�ץ%��'�34��s�m%n-E��o�K*"���V⒊Ha���%���.qIE���D�K*!Ž-��%�"�'��)p��9�<?���HG�i�)��W��S���vK\R)r��|{��ǽ-�ĭ��١��{�����'�;�HG��)�Q�G�����)�蝕/�+q�_D��~��;5E���G�"��y�)r��<zǥ���<z�9O�Go����%�K?J��5=���G/qk)"��xK\R)l���%��<_�K*"Ź ��y�o�ea����R\��%�"�y��ӏˣ��5�"�=�NMa����"�� ���"R�<e������%nME���y�NM��)��R��0��!E:��-��2��Y�b���E�H�g�SS䞯y�)���G��A���5�� ���K\G�"�)�荚���%nM%��Qf��Z�$���m����PK�;Uv��4J -FIGS_Payload_19015_8_600_20220819_023031.jsonPK[UJ
I can tell from reading the response that it's reading in the file somewhat-correctly, hence the FIGS_Payload...json string in the content, but what I don't understand is how to convert that response (which looks like base64 to me) into a usable/human-readable string. I've tried a number of solutions found in other answers - for example, putting this following function in the code:
def unzip(String compressed){
def inflaterStream = new GZIPInputStream(new ByteArrayInputStream(compressed.decodeBase64()))
def uncompressedStr = inflaterStream.getText('UTF-8')
return uncompressedStr
}
and then calling it via unzip(theLargeResponse). When I try that, I get Error:bad character in base64 value error - but I can't determine where the bad character is coming in or how to mitigate it. I've also tried the answer suggested here:
https://stackoverflow.com/a/45854656/5266746
But that gives me compilation errors when I put the string above in the PUT BASE 64ENCODED GZIPPED STRING HERE spot. I'm wondering if I'm even going about this the right way. Does anyone see anything that might stick out or make this make a bit more sense to me?
Thanks!
zip is not gzip. gzip is not zip.
You are reading in a zip file, indicated by the first two bytes "PK". You are then trying to decode it as a gzip file, which it isn't. You need save the thing and unzip it with unzip.
Related
I am using Cinchoo.PGP to decrypt some files. When it runs, I am getting an "Object reference not set to an instance of an object" error.
using (ChoPGPEncryptDecrypt pgp = new ChoPGPEncryptDecrypt())
{
EncryptionViewModel pem = rpt.Encryption_In;
var from = setFiles.FileToProcessPath + setFiles.FileToProcess;
var to = setFiles.ProcessedPath + setFiles.ProcessedName;
if (from == to)
{
to = setFiles.ProcessedPath + "_" + setFiles.ProcessedName;
pgp.DecryptFile(from, to, pem.PEMPath, pem.PassPhrase);
File.Delete(from);
File.Move(to, from);
}
else { pgp.DecryptFile(from, to, pem.PEMPath, pem.PassPhrase); }
}
Stack trace is here:
at Cinchoo.PGP.ChoPGPEncryptDecrypt.Decrypt(Stream inputStream, Stream outputStream, Stream privateKeyStream, String passPhrase)
at Cinchoo.PGP.ChoPGPEncryptDecrypt.DecryptFile(String inputFilePath, String outputFilePath, String privateKeyFilePath, String passPhrase)
at EDI2.Data.Process_Unencrypt_File.Process(ReportAllDataViewModel rpt) in C:\TWRAProjects\EDI2\EDI2\Data\Data_Process.cs:line 544
When I step through the code, all my variables are correct. My files exist, the pgp reference is valid, my "from" file exists (I manually verified that), my "to" file doesn't exist (same), and my PEMPath and PassPhrase values are populated.
When it runs the pgp.DecryptFile line, however, it throws the "object reference" error.
I'm not sure if I've found a bug in Cinchoo.PGP, or if I am doing something wrong. Anyone have any thoughts? Has anyone else experienced this?
Thanks,
Carthax
I am developing an app that uploads PDF files to a specific Google Drive folder. The file name includes the current date. The following code is for my DriveServiceHelper.class that is used to create a folder in Google Drive and then upload the PDF files into that folder using its folderID:
public class DriveServiceHelper {
Calendar c = Calendar.getInstance();
Date d = c.getTime();
SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
String currentDate = df.format(d);
String ps_FolderKey;
private final Executor mExecutor = Executors.newSingleThreadExecutor();
private Drive mDriveService;
public DriveServiceHelper(Drive mDriveService) {
this.mDriveService = mDriveService;
}
public Task<String> createFolder() {
return Tasks.call(mExecutor, () -> {
File folderMetadata = new File();
folderMetadata.setName("Covid Assessment Sheets");
folderMetadata.setMimeType("application/vnd.google-apps.folder");
File myFolder = null;
try {
myFolder = mDriveService.files().create(folderMetadata)
.setFields("id")
.execute();
System.out.println("Folder ID: " + myFolder.getId());
} catch (Exception e) {
e.printStackTrace();
}
if (myFolder == null) {
throw new IOException("Null result when requesting file creation");
}
ps_FolderKey = myFolder.getId();
return ps_FolderKey;
});
}
public Task<String> createFilePDF(String filePath, String folderId) {
return Tasks.call(mExecutor, () -> {
File fileMetaData = new File();
fileMetaData.setName("Covid Assessment # " + currentDate);
fileMetaData.setParents(Collections.singletonList(folderId));
java.io.File file = new java.io.File(filePath);
FileContent mediaContent = new FileContent("application/pdf", file);
File myFile = null;
try {
myFile = mDriveService.files().create(fileMetaData, mediaContent).execute();
} catch (Exception e) {
e.printStackTrace();
}
if (myFile == null) {
throw new IOException("Null result when requesting file creation");
}
return myFile.getId();
});
}
}
When uploading the same PDF to a Google Drive folder, I want to overwrite files with the same name, but instead duplicate files are created in the folder as the fileID assigned is different even if file name is the same.
Please help me understand how I should go about this, to automatically overwrite/replace files that already exist with the same name (each file is differentiated by date), and a new PDF file is created if the PDF file does not exist in the folder.
I understand that I might be using the deprecated Drive API, but I was unable to find other solutions online to help me implement what I need. I also came across solutions that include queries to search for existing Google Drive files, but I am not sure I understand how to use it to make it work for me.
Thank you
Google Drive supports multiple files with the same name
Thus, by creating a file with an already existing name, you will not automatically overwrite the old file.
Instead you should do the following:
Use the method Files:list with the query name = 'Covid Assessment Sheets' to find the already existing file(s) with the same name
If desired, you can narrow down the results by also specifying the mimeType and the parent folder (parents)
Retrieve the id of the list result(s)
Use the method Files:delete to delete the existing file
Proceed to create a new file as you are already doing
In Java this would look as following:
FileList result = DriveService.files().list()
.setQ("name = 'Covid Assessment Sheets'");
.setFields("files(id)")
.execute();
List<File> files = result.getFiles();
for (File file : files) {
DriveService.files().delete(file.getId()).execute();
}
An alternative approach would be to update the contents of the already existing file instead of creating a new one.
How can I generate several text files at the same time locally?
I am using the method:
throw new PXRedirectToFileException (file, true);
![enter image description here][1]
However, this method only generates 1 text file. I need more than 1 text file to be generated at a time.
List<object> data1099Misc = new List<object> { };
ARInvoice ari = Base.Document.Current;
foreach (xvrFSCab diot in PXSelect<xvrFSCab,
Where<xvrFSCab.invoiceNbr,
In<Required<xvrFSCab.invoiceNbr>>>>.Select(Base, ari.InvoiceNbr))
{
data1099Misc.Add(CreatePayerARecord(diot));
}
FixedLengthFile flatFile = new FixedLengthFile();
flatFile.WriteToFile(data1099Misc, sw);
sw.Flush();
sw.FlushAsync();
int cont = 0;
while ( cont<3)
{
cont = cont + 1;
string path = "DIOTJOSE" + ".txt";
PX.SM.FileInfo file = new PX.SM.FileInfo(path, null, stream.ToArray());
throw new PXRedirectToFileException(file, true);
}
Acumatica had the same issue when they had to open multiple reports at one click (with RedirectException).
For this reason Acumatica supports multiple RequiredException only for Reports.
They have a method called "CombineReport" that works with multiple PXReportRequiredException (PXReportsRedirectList)
Sad part is that they did not make something for other RequiredException or RedirectException
I tried to make my own "Combine" method but I was not able to create it just because the RedirectHelper.TryRedirect method use hardcoded types of the RedirectException inside body instead to use an generic or base object :(
I have a JAR file with following structure:
com
-- pack1
-- A.class
-- pack2
-- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.class
When I try to read, extract or rename pack2/AA...AA.class (which has a 262 byte long filename) both Linux and Windows say filename is too long. Renaming inside the JAR file doesn't also work.
Any ideas how to solve this issue and make the long class file readable?
This pages lists the usual limits of file systems: http://en.wikipedia.org/wiki/Comparison_of_file_systems
As you can see in the "Limits" section, almost no file system allows more than 255 characters.
Your only chance is to write a program that extracts the files and shortens file names which are too long. Java at least should be able to open the archive (try jar -tvf to list the content; if that works, truncating should work as well).
java.util.jar can handle it:
try {
JarFile jarFile = new JarFile("/path/to/target.jar");
Enumeration<JarEntry> jarEntries = jarFile.entries();
int i = 0;
while (jarEntries.hasMoreElements()) {
JarEntry jarEntry = jarEntries.nextElement();
System.out.println("processing entry: " + jarEntry.getName());
InputStream jarFileInputStream = jarFile.getInputStream(jarEntry);
OutputStream jarOutputStream = new FileOutputStream(new File("/tmp/test/test" + (i++) + ".class")); // give temporary name to class
while (jarFileInputStream.available() > 0) {
jarOutputStream.write(jarFileInputStream.read());
}
jarOutputStream.close();
jarFileInputStream.close();
}
} catch (IOException ex) {
Logger.getLogger(JARExtractor.class.getName()).log(Level.SEVERE, null, ex);
}
The output willbe test<n>.class for each class.
I have a function that downloads files from a web server that is sometimes fed an empty collection. In the function I call each on that collection and what I would expect to happen is that the function just exits with the each closure not being run at all. The problem is that it does get run with an empty filename parameter and the creation of the FileOutputStream goes boom when it is fed a directory instead of a file.
def get(String baseUrl, List files, String targetDir) {
files.each { filename ->
// Goes BOOM on next line
def fos = new FileOutputStream(targetDir + File.separator + filename)
...
}
Why does Groovy behave like this and what should I do instead?
It doesn't, so I assume files contains something (like null?)
[].each {
println "boom" // This doesn't appear
}
[null].each {
println "pow!" // this does
}
Assuming it is nulls in your files List that is causing the issue, you can get rid of them by:
files.findAll().each { filename ->
def fos = new FileOutputStream( new File( targetDir, filename ) )
...
Or of course, make the thing that generates the List not add nulls in the first place
Edit
Actually, it sounds like you have a List with empty strings in it...
The findAll fix should still work, as empty strings evaluate to false under Groovy Truth
Edit 2
As a quick note, you can probably change:
def fos = new FileOutputStream( new File( targetDir, filename ) )
...
to:
new File( targetDir, filename ).withOutputStream { fos ->
...
And it will ensure the stream is closed for you :-)