public static class AbstractXmlParser.CachedFileEntityResolver
extends java.lang.Object
implements org.xml.sax.EntityResolver
EntityResolver.
Using a mechanism of cached files in temp dir to improve performance when using the XMLReader.| Modifier and Type | Field and Description |
|---|---|
protected static java.util.Map<java.lang.String,byte[]> |
ENTITY_CACHE
Map with systemId as key and the content of systemId as byte[].
|
| Constructor and Description |
|---|
CachedFileEntityResolver() |
| Modifier and Type | Method and Description |
|---|---|
private void |
copy(byte[] res,
java.io.File f)
Wrap
IOUtil.copy(byte[], OutputStream) to throw SAXException. |
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId) |
private static byte[] |
toByteArray(java.net.URL url)
If url is not an http/https urls, call
IOUtil.toByteArray(java.io.InputStream) to get the url
content. |
protected static final java.util.Map<java.lang.String,byte[]> ENTITY_CACHE
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException,
java.io.IOException
resolveEntity in interface org.xml.sax.EntityResolverorg.xml.sax.SAXExceptionjava.io.IOExceptionprivate static byte[] toByteArray(java.net.URL url)
throws org.xml.sax.SAXException
IOUtil.toByteArray(java.io.InputStream) to get the url
content.
Otherwise, use HttpClient to get the http content.
Wrap all internal exceptions to throw SAXException.url - not nullorg.xml.sax.SAXException - if anyprivate void copy(byte[] res,
java.io.File f)
throws org.xml.sax.SAXException
IOUtil.copy(byte[], OutputStream) to throw SAXException.res - not null array of bytef - the file where to write the bytesorg.xml.sax.SAXException - if anyIOUtil#copy(byte[], OutputStream)}