code: public static void close(final InputSource input) throws IOException {
          if (input != null) {
              final InputStream i = input.getByteStream();
              if (i != null) {
                  i.close();
              } else {
                  final Reader w = input.getCharacterStream();
                  if (w != null) {
                      w.close();
                  }
              }
          }
      }
docs: Close input source.