Package org.apache.maven.doxia.parser
Class AbstractXmlParser.CachedFileEntityResolver
java.lang.Object
org.apache.maven.doxia.parser.AbstractXmlParser.CachedFileEntityResolver
- All Implemented Interfaces:
EntityResolver
- Enclosing class:
- AbstractXmlParser
public static class AbstractXmlParser.CachedFileEntityResolver
extends Object
implements EntityResolver
Implementation of the callback mechanism
EntityResolver
.
Using a mechanism of cached files in temp dir to improve performance when using the XMLReader
.-
Field Summary
FieldsModifier and TypeFieldDescriptionMap with systemId as key and the content of systemId as byte[]. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
WrapIOUtil.copy(byte[], OutputStream)
to throw SAXException.resolveEntity
(String publicId, String systemId) private static byte[]
toByteArray
(URL url) If url is not an http/https urls, callIOUtil.toByteArray(java.io.InputStream)
to get the url content.
-
Field Details
-
ENTITY_CACHE
Map with systemId as key and the content of systemId as byte[].
-
-
Constructor Details
-
CachedFileEntityResolver
public CachedFileEntityResolver()
-
-
Method Details
-
resolveEntity
- Specified by:
resolveEntity
in interfaceEntityResolver
- Throws:
SAXException
IOException
-
toByteArray
If url is not an http/https urls, callIOUtil.toByteArray(java.io.InputStream)
to get the url content. Otherwise, use HttpClient to get the http content. Wrap all internal exceptions to throw SAXException.- Parameters:
url
- not null- Returns:
- return an array of byte
- Throws:
SAXException
- if any
-
copy
WrapIOUtil.copy(byte[], OutputStream)
to throw SAXException.- Parameters:
res
- not null array of bytef
- the file where to write the bytes- Throws:
SAXException
- if any- See Also:
-
IOUtil.copy(byte[], OutputStream)
-