Example #1
0
 @Override
 public byte[] getResult() {
   try {
     int contentLength = connection.getContentLength();
     ByteArrayOutputStream buffer;
     if (contentLength > 0) buffer = new OptimizedByteArrayOutputStream(contentLength);
     else buffer = new OptimizedByteArrayOutputStream();
     StreamUtils.copyStream(inputStream, buffer);
     return buffer.toByteArray();
   } catch (IOException e) {
     return StreamUtils.EMPTY_BYTES;
   }
 }