Package org.jsoup.helper
Class DataUtil
java.lang.Object
org.jsoup.helper.DataUtil
public final class DataUtil extends Object
Internal static utilities for handling data.
-
Method Summary
Modifier and Type Method Description static Document
load(File in, String charsetName, String baseUri)
Loads a file to a Document.static Document
load(InputStream in, String charsetName, String baseUri)
Parses a Document from an input steam.static Document
load(InputStream in, String charsetName, String baseUri, Parser parser)
Parses a Document from an input steam, using the provided Parser.static ByteBuffer
readToByteBuffer(InputStream inStream, int maxSize)
Read the input stream into a byte buffer.
-
Method Details
-
load
Loads a file to a Document.- Parameters:
in
- file to loadcharsetName
- character set of inputbaseUri
- base URI of document, to resolve relative links against- Returns:
- Document
- Throws:
IOException
- on IO error
-
load
Parses a Document from an input steam.- Parameters:
in
- input stream to parse. You will need to close it.charsetName
- character set of inputbaseUri
- base URI of document, to resolve relative links against- Returns:
- Document
- Throws:
IOException
- on IO error
-
load
public static Document load(InputStream in, String charsetName, String baseUri, Parser parser) throws IOExceptionParses a Document from an input steam, using the provided Parser.- Parameters:
in
- input stream to parse. You will need to close it.charsetName
- character set of inputbaseUri
- base URI of document, to resolve relative links againstparser
- alternateparser
to use.- Returns:
- Document
- Throws:
IOException
- on IO error
-
readToByteBuffer
Read the input stream into a byte buffer. To deal with slow input streams, you may interrupt the thread this method is executing on. The data read until being interrupted will be available.- Parameters:
inStream
- the input stream to read frommaxSize
- the maximum size in bytes to read from the stream. Set to 0 to be unlimited.- Returns:
- the filled byte buffer
- Throws:
IOException
- if an exception occurs whilst reading from the input stream.
-