Java Code Examples for org.jsoup.helper.DataUtil#load()

The following examples show how to use org.jsoup.helper.DataUtil#load() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * 将流读取为 jsoup Document
 *
 * @param inputStream InputStream
 * @return Document
 */
public static Document readDocument(InputStream inputStream) {
	try {
		return DataUtil.load(inputStream, StandardCharsets.UTF_8.name(), "");
	} catch (IOException e) {
		throw Exceptions.unchecked(e);
	}
}
 
Example 2
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Parse the contents of a file as HTML.

 @param in          file to load HTML from
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(File in, String charsetName, String baseUri) throws IOException {
    return DataUtil.load(in, charsetName, baseUri);
}
 
Example 3
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Parse the contents of a file as HTML. The location of the file is used as the base URI to qualify relative URLs.

 @param in          file to load HTML from
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 @see #parse(File, String, String)
 */
public static Document parse(File in, String charsetName) throws IOException {
    return DataUtil.load(in, charsetName, in.getAbsolutePath());
}
 
Example 4
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Read an input stream, and parse it to a Document.

 @param in          input stream to read. Make sure to close it after parsing.
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(InputStream in, String charsetName, String baseUri) throws IOException {
    return DataUtil.load(in, charsetName, baseUri);
}
 
Example 5
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Read an input stream, and parse it to a Document. You can provide an alternate parser, such as a simple XML
 (non-HTML) parser.

 @param in          input stream to read. Make sure to close it after parsing.
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @param parser alternate {@link Parser#xmlParser() parser} to use.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(InputStream in, String charsetName, String baseUri, Parser parser) throws IOException {
    return DataUtil.load(in, charsetName, baseUri, parser);
}
 
Example 6
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Parse the contents of a file as HTML.

 @param in          file to load HTML from
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(File in, String charsetName, String baseUri) throws IOException {
    return DataUtil.load(in, charsetName, baseUri);
}
 
Example 7
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Parse the contents of a file as HTML. The location of the file is used as the base URI to qualify relative URLs.

 @param in          file to load HTML from
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 @see #parse(File, String, String)
 */
public static Document parse(File in, String charsetName) throws IOException {
    return DataUtil.load(in, charsetName, in.getAbsolutePath());
}
 
Example 8
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Read an input stream, and parse it to a Document.

 @param in          input stream to read. Make sure to close it after parsing.
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(InputStream in, String charsetName, String baseUri) throws IOException {
    return DataUtil.load(in, charsetName, baseUri);
}
 
Example 9
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Read an input stream, and parse it to a Document. You can provide an alternate parser, such as a simple XML
 (non-HTML) parser.

 @param in          input stream to read. Make sure to close it after parsing.
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @param parser alternate {@link Parser#xmlParser() parser} to use.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(InputStream in, String charsetName, String baseUri, Parser parser) throws IOException {
    return DataUtil.load(in, charsetName, baseUri, parser);
}
 
Example 10
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Parse the contents of a file as HTML.

 @param in          file to load HTML from
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(File in, String charsetName, String baseUri) throws IOException {
    return DataUtil.load(in, charsetName, baseUri);
}
 
Example 11
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Parse the contents of a file as HTML. The location of the file is used as the base URI to qualify relative URLs.

 @param in          file to load HTML from
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 @see #parse(File, String, String)
 */
public static Document parse(File in, String charsetName) throws IOException {
    return DataUtil.load(in, charsetName, in.getAbsolutePath());
}
 
Example 12
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Read an input stream, and parse it to a Document.

 @param in          input stream to read. Make sure to close it after parsing.
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(InputStream in, String charsetName, String baseUri) throws IOException {
    return DataUtil.load(in, charsetName, baseUri);
}
 
Example 13
Source Project: astor   File: Jsoup.java    License: GNU General Public License v2.0 votes vote down vote up
/**
 Read an input stream, and parse it to a Document. You can provide an alternate parser, such as a simple XML
 (non-HTML) parser.

 @param in          input stream to read. Make sure to close it after parsing.
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @param parser alternate {@link Parser#xmlParser() parser} to use.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(InputStream in, String charsetName, String baseUri, Parser parser) throws IOException {
    return DataUtil.load(in, charsetName, baseUri, parser);
}
 
Example 14
Source Project: jsoup-learning   File: Jsoup.java    License: MIT License votes vote down vote up
/**
 Parse the contents of a file as HTML.

 @param in          file to load HTML from
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(File in, String charsetName, String baseUri) throws IOException {
    return DataUtil.load(in, charsetName, baseUri);
}
 
Example 15
Source Project: jsoup-learning   File: Jsoup.java    License: MIT License votes vote down vote up
/**
 Parse the contents of a file as HTML. The location of the file is used as the base URI to qualify relative URLs.

 @param in          file to load HTML from
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 @see #parse(File, String, String)
 */
public static Document parse(File in, String charsetName) throws IOException {
    return DataUtil.load(in, charsetName, in.getAbsolutePath());
}
 
Example 16
Source Project: jsoup-learning   File: Jsoup.java    License: MIT License votes vote down vote up
/**
 Read an input stream, and parse it to a Document.

 @param in          input stream to read. Make sure to close it after parsing.
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(InputStream in, String charsetName, String baseUri) throws IOException {
    return DataUtil.load(in, charsetName, baseUri);
}
 
Example 17
Source Project: jsoup-learning   File: Jsoup.java    License: MIT License votes vote down vote up
/**
 Read an input stream, and parse it to a Document. You can provide an alternate parser, such as a simple XML
 (non-HTML) parser.

 @param in          input stream to read. Make sure to close it after parsing.
 @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
 present, or fall back to {@code UTF-8} (which is often safe to do).
 @param baseUri     The URL where the HTML was retrieved from, to resolve relative links against.
 @param parser alternate {@link Parser#xmlParser() parser} to use.
 @return sane HTML

 @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
 */
public static Document parse(InputStream in, String charsetName, String baseUri, Parser parser) throws IOException {
    return DataUtil.load(in, charsetName, baseUri, parser);
}