Class DefaultUserAgent

java.lang.Object
io.sf.carte.doc.agent.AbstractUserAgent
io.sf.carte.doc.agent.net.DefaultUserAgent
All Implemented Interfaces:
UserAgent, UserAgent.AgentControl, Serializable

public class DefaultUserAgent extends AbstractUserAgent
Default User Agent.

See Also:
  • Constructor Details

    • DefaultUserAgent

      protected DefaultUserAgent(EnumSet<Parser.Flag> parserFlags, boolean setDefaultSheet)
  • 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

      protected EntityResolver createEntityResolver()
    • getDOMImplementation

      public CSSDOMImplementation getDOMImplementation()
      Gets the DOM implementation used by this user agent.
      Returns:
      the DOM implementation.
    • setEntityResolver

      public void setEntityResolver(EntityResolver resolver)
      Sets the entity resolver to be used when parsing documents.
      Parameters:
      resolver - the entity resolver.
    • readURL

      public DOMDocument readURL(URL url) throws IOException, DocumentException
      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

      protected InputStream openInputStream(URLConnection con) throws IOException
      Throws:
      IOException