docs: public static void close(final Result result) throws IOException {
          if (result != null && result instanceof StreamResult) {
              final StreamResult r = (StreamResult) result;
              final OutputStream o = r.getOutputStream();
              if (o != null) {
                  o.close();
              } else {
                  final Writer w = r.getWriter();
                  if (w != null) {
                      w.close();
                  }
              }
          }
      }