code: public static byte[] readFullyNoClose(InputStream in) throws IOException {
          ByteArrayOutputStream bytes = new ByteArrayOutputStream();
          byte[] buffer = new byte[1024];
          int count;
          while ((count = in.read(buffer)) != -1) {
              bytes.write(buffer, 0, count);
          }
          return bytes.toByteArray();
      }
docs: Returns a byte[] containing the remainder of 'in'.