java.lang.Object
io.sf.carte.doc.agent.AbstractUserAgent
io.sf.carte.doc.agent.net.DefaultUserAgent
- All Implemented Interfaces:
UserAgent
,UserAgent.AgentControl
,Serializable
Default User Agent.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.sf.carte.doc.agent.UserAgent
UserAgent.AgentControl
-
Constructor Summary
ModifierConstructorDescriptionprotected
DefaultUserAgent
(EnumSet<Parser.Flag> parserFlags, boolean setDefaultSheet) -
Method Summary
Modifier and TypeMethodDescriptionprotected EntityResolver
static DefaultUserAgent
createUserAgent
(EnumSet<Parser.Flag> parserFlags, boolean setDefaultSheet) Creates an user agent that reads HTML documents.Gets the DOM implementation used by this user agent.protected InputStream
Reads and parses a markup document located at the given URL.void
setEntityResolver
(EntityResolver resolver) Sets the entity resolver to be used when parsing documents.Methods inherited from class io.sf.carte.doc.agent.AbstractUserAgent
authenticationCredentials, createConnection, getAgentControl, getAuthenticationCredentials, getCookieConfig, getCookies, getOriginPolicy, getParserFlags, getProperty, isVisitedURL, openConnection, readCookies, setConnectionTimeout, setOriginPolicy, setProperty, setUseragentId
-
Constructor Details
-
DefaultUserAgent
-
-
Method Details
-
createUserAgent
public static DefaultUserAgent createUserAgent(EnumSet<Parser.Flag> parserFlags, boolean setDefaultSheet) Creates an user agent that reads HTML documents.- Parameters:
setDefaultSheet
- if true, a default user agent HTML style sheet is loaded.- Returns:
- the user agent.
-
createEntityResolver
-
getDOMImplementation
Gets the DOM implementation used by this user agent.- Returns:
- the DOM implementation.
-
setEntityResolver
Sets the entity resolver to be used when parsing documents.- Parameters:
resolver
- the entity resolver.
-
readURL
Reads and parses a markup document located at the given URL.- Parameters:
url
- the URL that points to the document.- Returns:
- the DOMDocument.
- Throws:
IOException
- if there is an I/O problem reading the URL.DocumentException
- if there is a problem parsing the document.
-
openInputStream
- Throws:
IOException
-