code: protected static InputReader getInput(InputSource input, int size, Charset cs, Set<ParserFeature> fea) throws IOException
      {
          EnumSet<ParserFeature> features = EnumSet.of(UseInclude, UsePushback, UseModifiableCharset);
          InputReader inputReader = null;
          Reader reader = input.getCharacterStream();
          if (reader != null)
          {
              inputReader = new ReadableInput(getFeaturedReader(reader, size, features), size, features);
          }
          else
          {
              InputStream is = input.getByteStream();
              String encoding = input.getEncoding();
              if (is != null)
              {
                  if (encoding != null)
                  {
                      inputReader = getInstance(is, size, encoding, features);
                  }
                  else
                  {
                      inputReader = getInstance(is, size, StandardCharsets.US_ASCII, features);
                  }
              }
              else
              {
                  String sysId = input.getSystemId();
                  try
                  {
                      URI uri = new URI(sysId);
                      if (encoding != null)
                      {
                          inputReader = getInstance(uri, size, encoding, features);
                      }
                      else
                      {
                          inputReader = getInstance(uri, size, StandardCharsets.US_ASCII, features);
                      }
                  }
                  catch (URISyntaxException ex)
                  {
                      throw new IOException(ex);
                  }
              }
          }
          inputReader.setSource(input.getSystemId());
          return inputReader;
      }
docs: Creates an InputReader
  @param input
  @param size Ringbuffer size
  @return
  @throws IOException