org.apache.batik.bridge

Class DocumentLoader

public class DocumentLoader extends Object

This class is responsible on loading an SVG document and maintaining a cache.
Field Summary
protected HashMapcacheMap
The map that contains the Document indexed by the URI.
protected SVGDocumentFactorydocumentFactory
The document factory used to create the document according a DOM implementation.
protected UserAgentuserAgent
The user agent.
Constructor Summary
protected DocumentLoader()
Constructs a new DocumentLoader.
DocumentLoader(UserAgent userAgent)
Constructs a new DocumentLoader with the specified XML parser.
Method Summary
DocumentcheckCache(String uri)
voiddispose()
Disposes and releases all resources allocated by this document loader.
intgetLineNumber(Element e)
Returns the line in the source code of the specified element or -1 if not found.
UserAgentgetUserAgent()
Returns the userAgent used by this DocumentLoader
DocumentloadDocument(String uri)
Returns a document from the specified uri.
DocumentloadDocument(String uri, InputStream is)
Returns a document from the specified uri.

Field Detail

cacheMap

protected HashMap cacheMap
The map that contains the Document indexed by the URI. WARNING: tagged private as no element of this Map should be referenced outise of this class

documentFactory

protected SVGDocumentFactory documentFactory
The document factory used to create the document according a DOM implementation.

userAgent

protected UserAgent userAgent
The user agent.

Constructor Detail

DocumentLoader

protected DocumentLoader()
Constructs a new DocumentLoader.

DocumentLoader

public DocumentLoader(UserAgent userAgent)
Constructs a new DocumentLoader with the specified XML parser.

Parameters: userAgent the user agent to use

Method Detail

checkCache

public Document checkCache(String uri)

dispose

public void dispose()
Disposes and releases all resources allocated by this document loader.

getLineNumber

public int getLineNumber(Element e)
Returns the line in the source code of the specified element or -1 if not found.

Parameters: e the element

Returns: -1 the document has been removed from the cache or has not been loaded by this document loader.

getUserAgent

public UserAgent getUserAgent()
Returns the userAgent used by this DocumentLoader

loadDocument

public Document loadDocument(String uri)
Returns a document from the specified uri.

Parameters: uri the uri of the document

Throws: IOException if an I/O error occured while loading the document

loadDocument

public Document loadDocument(String uri, InputStream is)
Returns a document from the specified uri.

Parameters: uri the uri of the document

Throws: IOException if an I/O error occured while loading the document

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.