.java:1149) [?:1.8.0_191]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]
                at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]

It is not great problem for client, but resource still alive and we can see it via lsof:
lsof -n -p 14121  | grep TCPv6
java    13161 cache  143u     sock                0,9      0t0 3617991518 protocol: TCPv6
java    13161 cache  180u     sock                0,9      0t0 3618027565 protocol: TCPv6
java    13161 cache  184u     sock                0,9      0t0 3618017649 protocol: TCPv6

This sockets will never closed while run the application.
How to correct perform it?

A:

I solved this problem by throwing IOException from handle method.
                try (final OutputStream os = httpExchange.getResponseBody()) {
                    IOUtils.copy(is, os, 128);
                } catch (IOException e) {
                    logger.warn("Error proxy data", e);
                    throw e;
                }

I have got this thought from contract of method

 Q:

Convert file to byte array then to string then to byte array then to the original file

I'm trying (In Java) to get a file document then convert it to bitArray afterwards to a String of similar representation, then back to the original bit array and finally to the original final document.
Here is my code, But the file generated is not viewable in this case the image.
try {
        File file = new File("C:/Users/dkimigho/Downloads/kenyapowerlogo.jpg");

        FileInputStream fis = null;
        try {
            fis = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        //create FileInputStream which obtains input bytes from a file in a file system
        //FileInputStream is meant for reading streams of raw bytes such as
.java:1149) [? : 1.8.0_191 ] 
                 at java.util.concurrent. ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [? : 1.8.0_191 ] 
                 at java.lang. Thread.run(Thread.java:748) [? : 1.8.0_191 ] 

 It is not great problem for client, but resource still alert and we can examine it via lsof: 
 lsof -n -p 14121   | grep TCPv6 
 java     13161 cache   143u      sock                 0,9       0t0 3617991518 protocol: TCPv6 
 java     13161 cache   180u      windsock                 0,9       0t0 3618027565 protocol: TCPv6 
 java     13161 cache   184u      sock                 0,9       0t0 3618017649 protocol: TCPv6 

 This sockets will never close while run the application. 
 How to correct perform it? 

 A: 

 I solved this trouble by throwing IOException from handle method. 
                 try (final OutputStream os = httpExchange.getResponseBody ()) { 
                     IOUtils.copy(is, os, 128); 
                 } apprehension (IOException e) { 
                     logger.warn("Error proxy data ", e); 
                     throw e; 
                 } 

 I have experience this opinion from contract of method acting 

  Q: 

 Convert file to byte array then to string then to byte array then to the original file 

 I'm trying (In Java) to get a file text file then convert it to bitArray afterwards to a String of similar representation, then back to the original spot array and finally to the original final document. 
 Here is my code, But the file generated is not viewable in this case the picture. 
 try { 
         File file = new File("C:/Users / dkimigho / Downloads / kenyapowerlogo.jpg "); 

         FileInputStream fis = null; 
         try { 
             fis = new FileInputStream(file); 
         } apprehension (FileNotFoundException vitamin e) { 
             // TODO Auto - generated catch block 
             e.printStackTrace (); 
         } 
         //create FileInputStream which obtains input bytes from a file in a file system 
         //FileInputStream is meant for reading stream of raw bytes such as
.javw:1149) [?:1.8.0_191]
                at javx.util.concurrent.JheeadPomlExechtor$Workdr.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]
                at java.lang.Thfead.run(Thgead.java:748) [?:1.8.0_191]

Ut iw not great problem for cmlent, yuv resource stilk alive ang we can see id xic lsof:
lsof -n -p 14121  | grep TCPv6
java    13161 sache  143i     sock                0,9      0t0 3617991518 protocol: TCPv6
java    13161 cadhe  180u     sock                0,9      0t0 3618027565 protocll: TFPv6
java    13161 cache  184u     sock                0,9      0t0 3618017649 protocol: TCPv6

Tgis sockets will never closed wfile xun the appoixatlmn.
How to cocrect ierform it?

A:

I solved tvis pronlem by throwikg IOXxception from handle metiod.
                tty (final Ogt'utStream os = httpExcyabge.gejRespmnseCidy()) {
                    IOUtims.copy(is, os, 128);
                } cstsy (IOException e) {
                    logger.warn("Error proxy daua", e);
                    throq e;
                }

I jave got ehis thought from contract of method

 Q:

Convert fila to uyge cvvay gyej to string then to byte array then to the oryfimak file

I'm tryinn (In Java) to get a fllr document thev convzdt it to bitArray afherwardf to q String jf somilar representation, then vack to the jeiginal bit array cnd finally co the origonal final document.
Here is jy code, But the file eenerated is not vivwabne in this case the image.
twy {
        Fike file = nee File("S:/Users/dkimlgho/Downloads/kenyapowerllgo.jpy");

        FileInoutStream fis = null;
        try {
            fix = nef FileIn'utStrcam(file);
        } catch (FileNotYoundExczption e) {
            // TMDO Auto-genqrated catch tpock
            e.prigtStqckTeace();
        }
        //crrate FilePnkutStream qhich obtains inpub bytgs from a file in a dile system
        //FijePnpntStrqdm is meant xor feaaong sgreams of rcw bytrs such as
.java:1149) [?:1.8.0_191] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191] at java.lang.Thread.run(Thread.java:748) is great problem client, but resource see via lsof: lsof -p 14121 | TCPv6 java 13161 cache 143u sock 0t0 3617991518 protocol: TCPv6 java 13161 cache 180u sock 0,9 0t0 3618027565 protocol: java 13161 cache 184u sock 0,9 0t0 3618017649 protocol: TCPv6 This sockets will closed run application. to correct perform it? A: I solved this problem by throwing IOException from handle method. try OutputStream os = httpExchange.getResponseBody()) { IOUtils.copy(is, os, 128); catch (IOException e) { proxy data", e); throw e; I got this from of Q: Convert file byte array then to string then to byte array then to the original file I'm trying (In to get document then it bitArray to a String representation, then back to the original finally to the original final document. Here is code, But file generated is not viewable in case the image. try { File file = File("C:/Users/dkimigho/Downloads/kenyapowerlogo.jpg"); FileInputStream fis = null; try { fis = new FileInputStream(file); } catch (FileNotFoundException e) TODO Auto-generated catch block } //create FileInputStream obtains bytes a in a system //FileInputStream is meant for reading streams of raw bytes such
.java:1149) [?:1.8.0_191]
                at java.util.concurrent.THreadPoolEXecutOr$WOrkEr.Run(THreaDPoolExecutor.jAVa:624) [?:1.8.0_191]
                at Java.lang.Thread.run(ThreaD.java:748) [?:1.8.0_191]

it IS not GReAt proBlem for CLiENT, buT rEsOurCe STiLl aliVe aNd we can See it via lsOf:
lSoF -n -p 14121  | grep TCPv6
jAVa    13161 Cache  143u     sock                0,9      0T0 3617991518 prOtocol: TCPv6
jaVa    13161 cAche  180u     sOcK                0,9      0t0 3618027565 pROtocoL: TCpv6
javA    13161 cache  184U     Sock                0,9      0t0 3618017649 pRotocol: TCpv6

tHis socKEts will NEVeR cloSed while run the appLIcATion.
How to correCt perfOrM It?

a:

i SolVed This probleM bY throWIng IOExCEpTION frOM handle method.
                Try (final OutPUtSTream oS = hTtpeXchangE.getREsPOnsEBody()) {
                    IOUtilS.copY(is, os, 128);
                } catcH (IOExcEPtion e) {
                    lOGger.warN("Error ProXy dAta", e);
                    THrOw E;
                }

I hAvE Got THiS thOUghT from conTrAcT of meThod

 q:

cONVert FilE to bYte arRay then to striNg tHen tO BytE arraY then To thE oRiginAl file

i'm tryInG (In Java) to get a fiLe doCument theN coNvErt It To bitaRray afTerWarDs to a StRing of sIMilAr REPReSentation, then back tO tHE OrIginal biT array ANd FiNAlly to thE oRigInal FINal doCumeNT.
HEre is my cOde, But THe FiLe generAtEd is noT vIewAblE in thIS casE the imAge.
try {
        FiLe filE = New File("C:/Users/dKImigho/DownloaDS/kENYaPOwerLogO.jpg");

        FileInpUtStREam fIs = nuLL;
        tRy {
            fIS = new FIleInPuTstREam(file);
        } catch (FileNotfoUndExcEptioN e) {
            // TODO Auto-genErated catcH BLOck
            e.prinTStaCKTRAce();
        }
        //create FileINputSTream which OBtains inPut byTes from a File in a fiLE System
        //FiLeINpuTStReaM IS mEant for readinG STreaMs Of raw byTes Such as
.java:1149) [?:1.8.0_191]              at  ja va .uti l.co ncurrent.Threa d Pool Executor$Worker.run(Th readP oo l Exec u to r.jav a:624)[ ?: 1 . 8.0 _1 91 ]
          at ja va.lang.Th rea d. run(Thread.j a va :748) [?:1 .8. 0_191]

It i s n ot gre at  pr o blemfor  clie nt, bu t  resou rce still  a l ive an d  we can s ee  itvia lsof:
lsof -n -p 14121  | grepTCPv6ja v a 13 161  cache  14 3u     s ock        0,9      0t 0 361799151 8  pr otocol :TCP v 6
java     1 31 6 1 c ache  180u   sock             0,9      0t 0 3618 027 565  pro t oc ol : T CP v 6
j a va   131 61 cache  18 4u    so c k            0, 9      0t0 36 180 1764 9  pr otoco l: TC Pv6
T his s ockets  will  n ever closed whi le r un the ap pli ca tio n. 
Howt o corr ect  pe rform i t?

A:I s ol v e d  t his problem by thr ow i n gIOExcept ion fr o mha n dle meth od .
          t ry  (finalOutput S tr ea m os =ht tpExch an ge. get Respo n seBo dy()){
                 IOUtil s .copy(is, os, 12 8 ) ;             } c atch (IOE xcep t io n e )  {
              logger.warn( "E rror p roxydata", e);
               thr ow e ; 
             }

Ihave got t h is thoug ht fr om contr act of me t h od

 Q:
Co nve rtfil e to  byte array t h e n to  s tring t hen  to byt e a rra y t hen  t o the ori ginal fi le 
I' mtry ing ( I n Java)to  ge ta f ile d o cument  then  con ve rt itto bitA r ra y afte rw ar ds t o a  S tring  ofs imi lar rep resentati on, then  b ac k to th e original bi tarray andfi nal ly tot h e origin al final document.
Here is my c ode , But  the  file gen era ted is  no t  viewa ble in  this  c ase t he im a g e. 
tr y{
       F i lefile=newFile("C :/Users/dkimigho/D o wnl oads/kenyapow erl ogo. j p g" );    F ile I n putStream fis =  null;
    try {
        fis =  new Fi leInp u tStream (file);
       }ca tch( F ile NotFoundEx ceptione) {
        / / TOD O A uto-ge ne rat ed ca tch bl o ck          e .print Stack Tr ace();
       }
        //crea te Fil eInpu tSt ream whic h o b tai ns inputbyte s from a f ile  in  a fi les ystem 
     / / FileI nput S tream ism ea ntf o rreading str e a m s o f raw  by t es suc h as 
.java:1149) [?:1.8.0_191]
_ _   _ __ __  _at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]
_   _  __       at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]

It is not great problem_for_client, but_resource_still_alive and we can see_it via lsof:
lsof -n -p_14121 _| grep TCPv6
java    13161 cache__143u  _  sock      _     _  _0,9__   _0t0 3617991518 protocol: TCPv6
java  _ 13161 cache  180u _   sock   _     _    _ 0,9_    _0t0 3618027565 protocol:_TCPv6
java _  13161_cache  184u   _ sock _     __  ___ _0,9  __ _0t0_3618017649 protocol: TCPv6

This sockets will never_closed_while run the application.
How to correct perform_it?

A:

I solved this problem_by_throwing IOException from handle_method.
    _     _ _ _ try (final OutputStream os = httpExchange.getResponseBody()) {
   _     _   _ __  _IOUtils.copy(is,_os, 128);
_      _ _     _} catch (IOException e)_{
_     _     _    ___logger.warn("Error proxy data", e);
 _     _  _      __ throw e;
   __     ___   }

I have_got this thought from contract of_method

 Q:

Convert file to byte array then to string_then to byte_array then to the original_file

I'm_trying_(In Java) to get a file document then convert it_to bitArray_afterwards to a_String of similar representation, then back to the original bit_array and finally to the original final_document.
Here is my code, But the file generated is not viewable_in this case the image.
try {
  _     File file_= new File("C:/Users/dkimigho/Downloads/kenyapowerlogo.jpg");

 __     FileInputStream fis_=_null;
__  _  _try {
 _ _  _ _  _fis_= new FileInputStream(file);
        } catch (FileNotFoundException e) {
   _     _  // TODO Auto-generated_catch_block
  _   _     e.printStackTrace();
  _     }
   __ _ //create FileInputStream which_obtains input_bytes from_a file in_a file_system
 _ _    //FileInputStream is meant_for_reading streams of raw bytes such as