Takes an input string representing an html document and processes it with
the Css Inliner.

@param input the html document
@return the processed html document
341724
public String process(String input) {
        Document doc = Jsoup.parse(input);

        // check if the user wants to inline the data
        Elements elements = doc.getElementsByAttributeValue(DATA_INLINE_ATTR, "true");
        if (elements.isEmpty()) {
            return input;
        }

        extractStyles(doc);
        applyStyles(doc);
        inlineImages(doc);

        doc.outputSettings(doc.outputSettings().syntax(Document.OutputSettings.Syntax.xml).prettyPrint(false).escapeMode(Entities.EscapeMode.extended));
        return StringEscapeUtils.unescapeHtml(doc.outerHtml());
    }
99544
public String processIfMatches(final I input) {
        String uriAsString = input.getUri();
        String text = input.getTextToProcess();
        Matcher m = patternImpl.matcher(uriAsString);
        if (!m.find()) {
            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.fine("Rule " + getClass().getSimpleName()
                        + ": skipped " + uriAsString);
            }
            return text;
        }

        String result = new String(text);
        for (PatternBasedTextProcessor proc : processors) {
            result = proc.process(result);
        }

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Rule " + getClass().getSimpleName()
                    + ": processed " + uriAsString);
        }

        return result;
    }
1300705
public static List<String> toLines(final InputStream input) throws IOException {
		return CharStreams.readLines(new BufferedReader(new InputStreamReader(input, Charsets.UTF_8)));
	}
653356
function htmlDecode(input) {
  if (input === " ") return input;
  const doc = new DOMParser().parseFromString(input.replace(/<[^>]+>/g, ""), "text/html");
  return doc.documentElement.textContent;
}
1010845
public String tag2String(String input) {
		if(pos==null||seg==null)
			return null;
		return pos.tag(input);
	}
424824
public static ByteBuffer decode(String input) throws IOException {
		return decode(input.getBytes(StandardCharsets.US_ASCII));
	}
1356833
public static Document parseEscapedXmlString(String input) throws UnmarshalException {
		String deEscapedXml = deEscapeXml(input);
		return parseXmlString(deEscapedXml);
	}
347713
public static String readFileIntoString(URL input) throws IOException
   {

      InputStream stream = null;
      InputStreamReader reader = null;
      try
      {
         stream = input.openStream();
         reader = new InputStreamReader(stream);
         return readStreamIntoString(reader);
      }
      finally
      {
         if (reader != null)
            reader.close();
         if (stream != null)
            stream.close();
      }
   }
381437
function( input ) {

		if ( input == null ) {

			input = this.result;

		}

			this.result = input.replace(/(\s[\u0645]+[\u06CC])+\s/g, "$1\u200C");

			this.result = this.result.replace(/([\u0647])+\s+([\u0627]+[\u0645]||[\u0627]+[\u0649]||[\u0627]+[\u0649]+[\u0649]||[\u0627]+[\u0649]+[\u0645]||[\u0649]+[\u0646]+[\u062f]||[\u0627]+[\u0649]+[\u062f])/g, "$1\u200C$2");

			return this;

	}
641819
public SOAPEnvelope parse(InputStream input) throws Exception {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setValidating(false);
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.parse(input);
        SOAPElement soapElement = SOAPFactory.newInstance().createElement(doc.getDocumentElement());
        SOAPEnvelope envelope = (SOAPEnvelope) soapElement;
        return envelope;
    }
1176311
public String filter(String input) {

        StringBuilder output = new StringBuilder();
        Matcher tokenMatcher = tokenPattern.matcher(input);

        // Track last regex match
        int endOfLastMatch = 0;

        // For each possible token
        while (tokenMatcher.find()) {

            // Pull possible leading text and first char before possible token
            String literal = tokenMatcher.group(LEADING_TEXT_GROUP);
            String escape = tokenMatcher.group(ESCAPE_CHAR_GROUP);

            // Append leading non-token text
            output.append(literal);

            // If char before token is '$', the token itself is escaped
            if ("$".equals(escape)) {
                String notToken = tokenMatcher.group(TOKEN_GROUP);
                output.append(notToken);
            }

            // If char is not '$', interpret as a token
            else {

                // The char before the token, if any, is a literal
                output.append(escape);

                // Pull token value
                String tokenName = tokenMatcher.group(TOKEN_NAME_GROUP);
                String tokenValue = getToken(tokenName);

                // If token is unknown, interpret as literal
                if (tokenValue == null) {
                    String notToken = tokenMatcher.group(TOKEN_GROUP);
                    output.append(notToken);
                }

                // Otherwise, substitute value
                else
                    output.append(tokenValue);

            }

            // Update last regex match
            endOfLastMatch = tokenMatcher.end();
            
        }

        // Append any remaining non-token text
        output.append(input.substring(endOfLastMatch));
        
        return output.toString();
       
    }
482335
public static String cleanLeadingAndTrailingNewLineAndChars(String input) {

		if (!StringUtils.hasText(input)) {
			return input;
		}
		String output = input;
		output = output.replaceAll("[\\s]+\\*[\\s]+", " ");
		while (output.startsWith("/") || output.startsWith("\n") || output.startsWith("*") || output.startsWith("-")
				|| output.startsWith("\t") || output.startsWith(" ") || output.startsWith("\\")) {
			output = output.substring(1);
		}

		while (output.endsWith("/") || output.endsWith("\n") || output.endsWith(" ") || output.endsWith(",") || output.endsWith("\t")
				|| output.endsWith("-") || output.endsWith("*")) {
			output = output.substring(0, output.length() - 1);
		}
		return output;
	}
1203156
public static String encode(String input)
    {
        try
        {
            return URLEncoder.encode(input, "UTF-8");
        }
        catch (UnsupportedEncodingException e)
        {
            // This never happens.
            return input;
        }
    }
525071
private Input processRegularFileInput(String input) throws IOException {
    File inputFile = new File(input);
    if (!inputFile.exists()) {
      throw new IOException("Input does not exist: " + input);
    }
    if (pipeFiles) {
      SamReader samReader = SamReaderFactory.makeDefault().open(inputFile);
      return new Input(input, STDIN_FILE_NAME, 
          new SamReaderToSAMFilePump(samReader)); 
    } else {
      return new Input(input, input, null);
    }
  }
985496
private static Queue<String> removePrefix(final List<String> input) {
        if (input.size() < 2) {
            return new LinkedList<>(input);
        }
        String resultingPrefix = "";
        final String previousGreatestCommonPrefix = input.get(0).trim();
        String greatestCommonPrefix = "";
        for (int i = 1; i < input.size(); i++) {
            final String previousLine = input.get(i - 1).trim();
            final String currentLine = input.get(i).trim();
            greatestCommonPrefix = ExceptionParser.greatestCommonPrefix(previousLine, currentLine);
            resultingPrefix = ExceptionParser.greatestCommonPrefix(previousGreatestCommonPrefix, greatestCommonPrefix);
            if (resultingPrefix.length() == 0) {
                break;
            }
        }
        final int prefixLength = resultingPrefix.length();
        final boolean hasPrefix = prefixLength > 0;
        final Queue<String> result = new LinkedList<>();
        for (final String line : input) {
            final String line2 = line.trim();
            if (hasPrefix) {
                result.add(line2.substring(prefixLength));
            } else {
                result.add(line2);
            }
        }
        return result;
    }
1339281
public static String getContentTypeAttribute(String input, String name) {
        int begin;
        int end;
        int index = input.toUpperCase().indexOf(name.toUpperCase());
        if (index == -1) {
            return null;
        }
        index = index + name.length(); // positioned after the attribute name
        index = input.indexOf('=', index); // positioned at the '='
        if (index == -1) {
            return null;
        }
        index += 1; // positioned after the '='
        input = input.substring(index).trim();

        if (input.charAt(0) == '"') {
            // attribute value is a quoted string
            begin = 1;
            end = input.indexOf('"', begin);
            if (end == -1) {
                return null;
            }
        } else {
            begin = 0;
            end = input.indexOf(';');
            if (end == -1) {
                end = input.indexOf(' ');
            }
            if (end == -1) {
                end = input.length();
            }
        }
        return input.substring(begin, end).trim();
    }
438429
public static String escapeString(String input) {
        StringBuilder escaped = new StringBuilder(input.length() + 10);
        escaped.append('"');
        for (int i = 0; i < input.length(); i++) {
            if (input.charAt(i) == '"') {
                escaped.append("\"\"");
            } else {
                escaped.append(input.charAt(i));
            }
        }
        escaped.append('"');
        return escaped.toString();
    }