/[projects]/dao/DaoAdresseService/src/dk/daoas/daoadresseservice/util/HttpUtil.java
ViewVC logotype

Diff of /dao/DaoAdresseService/src/dk/daoas/daoadresseservice/util/HttpUtil.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2325 by torben, Tue Feb 17 09:06:42 2015 UTC revision 2326 by torben, Wed Feb 18 21:30:17 2015 UTC
# Line 137  public class HttpUtil { Line 137  public class HttpUtil {
137                    
138          static byte[] readInputStream(InputStream is) throws IOException{          static byte[] readInputStream(InputStream is) throws IOException{
139                  byte buffer[] = new byte[1024];                  byte buffer[] = new byte[1024];
140                  ByteArrayOutputStream baos = new ByteArrayOutputStream(32768); //start buffer size - instead of default 32bytes                  //try /; //start buffer size - instead of default 32bytes
141                  try {                  try (ByteArrayOutputStream baos = new ByteArrayOutputStream(32768)) {
142                          int count;                          int count;
143                            
144                          while ( (count = is.read(buffer)) != -1) {                          while ( (count = is.read(buffer)) != -1) {
145                                  baos.write(buffer, 0, count);                                  baos.write(buffer, 0, count);
146                          }                          }
147                  } finally {                          is.close();
148                          try {                          return baos.toByteArray();
149                                  is.close();                  }      
                                 baos.close();  
                         } catch (Exception e) {} //never mind if close throws an exception  
                 }  
                                   
                 return baos.toByteArray();                
150          }          }
151                    
152  }  }

Legend:
Removed from v.2325  
changed lines
  Added in v.2326

  ViewVC Help
Powered by ViewVC 1.1.20