public final class ReaderConfig extends CommonConfig
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ReaderConfig.EncodingContext
This is a simple container class that is used to encapsulate
per-factory encoding-dependant information like symbol tables.
|
Modifier and Type | Field and Description |
---|---|
protected BufferRecycler |
_currRecycler
This is the actually container of the recyclable buffers.
|
(package private) static java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>> |
_recyclerRef
This
ThreadLocal contains a SoftRerefence
to a BufferRecycler used to provide a low-cost
buffer recycling between Reader instances. |
static int |
DEFAULT_CHAR_BUFFER_LEN |
(package private) static int |
DEFAULT_FLAGS
These are the default settigs for XMLInputFactory.
|
static int |
DEFAULT_SMALL_BUFFER_LEN |
(package private) static int |
F_AUTO_CLOSE_INPUT |
(package private) static int |
F_COALESCING |
(package private) static int |
F_DTD_AWARE |
(package private) static int |
F_DTD_VALIDATING |
(package private) static int |
F_EXPAND_ENTITIES |
(package private) static int |
F_INTERN_NAMES |
(package private) static int |
F_INTERN_NS_URIS |
(package private) static int |
F_LAZY_PARSING |
(package private) static int |
F_NS_AWARE |
(package private) static int |
F_PRESERVE_LOCATION |
(package private) static int |
F_REPORT_CDATA |
private IllegalCharHandler |
illegalCharHandler |
private java.lang.String |
mActualEncoding
Name of the actual encoding that input was found to be in (if any
-- can't be determined if a Reader was passed in).
|
private UriCanonicalizer |
mCanonicalizer
For efficient access by qualified name, as well as uniqueness
checks, namespace URIs need to be canonicalized.
|
private ReaderConfig.EncodingContext |
mEncCtxt
A single encoding context instance is shared between all ReaderConfig
instances created for readers by an input factory.
|
private java.lang.String |
mExtEncoding
Encoding passed in as external information, possibly from source
from which xml content was gained from (for example, as an HTTP
header, or file metadata).
|
private java.lang.String |
mPublicId |
private javax.xml.stream.XMLReporter |
mReporter |
private javax.xml.stream.XMLResolver |
mResolver |
private java.lang.String |
mSystemId |
private java.lang.String |
mXmlDeclEncoding |
private int |
mXmlDeclStandalone |
private java.lang.String |
mXmlDeclVersion |
private static java.util.HashMap<java.lang.String,java.lang.Object> |
sProperties |
static int |
STANDALONE_NO |
static int |
STANDALONE_UNKNOWN |
static int |
STANDALONE_YES |
_flagMods, _flags, IMPL_NAME, IMPL_VERSION
Modifier | Constructor and Description |
---|---|
|
ReaderConfig() |
private |
ReaderConfig(java.lang.String publicId,
java.lang.String systemId,
java.lang.String extEnc,
ReaderConfig.EncodingContext encCtxt,
int flags,
int flagMods,
javax.xml.stream.XMLReporter rep,
javax.xml.stream.XMLResolver res,
UriCanonicalizer canonicalizer) |
Modifier and Type | Method and Description |
---|---|
byte[] |
allocFullBBuffer(int minSize) |
char[] |
allocFullCBuffer(int minSize) |
char[] |
allocMediumCBuffer(int minSize) |
char[] |
allocSmallCBuffer(int minSize) |
java.lang.String |
canonicalizeURI(char[] buf,
int uriLen) |
void |
configureForConvenience()
Method to call to make Reader created be as "convenient" to use
as possible; ie try to avoid having to deal with some of things
like segmented text chunks.
|
void |
configureForLowMemUsage()
Method to call to minimize the memory usage of the stream/event reader;
both regarding Objects created, and the temporary memory usage during
parsing.
|
void |
configureForRoundTripping()
Method to call to make Reader try to preserve as much of input
formatting as possible, so that round-tripping would be as lossless
as possible.
|
void |
configureForSpeed()
Method to call to make the Reader created be as fast as possible reading
documents, especially for long-running processes where caching is
likely to help.
|
void |
configureForXmlConformance()
Method to call to make Reader created conform as closely to XML
standard as possible, doing all checks and transformations mandated
(linefeed conversions, attr value normalizations).
|
ReaderConfig |
createNonShared(java.lang.String publicId,
java.lang.String systemId,
java.lang.String extEnc) |
private BufferRecycler |
createRecycler() |
void |
doAutoCloseInput(boolean state) |
void |
doCoalesceText(boolean state) |
void |
doParseLazily(boolean state) |
void |
doPreserveLocation(boolean state) |
void |
doReportCData(boolean state) |
protected int |
findPropertyId(java.lang.String propName) |
void |
freeFullBBuffer(byte[] buffer) |
void |
freeFullCBuffer(char[] buffer) |
void |
freeMediumCBuffer(char[] buffer) |
void |
freeSmallCBuffer(char[] buffer) |
java.lang.String |
getActualEncoding() |
ByteBasedPNameTable |
getBBSymbols() |
CharBasedPNameTable |
getCBSymbols() |
XmlCharTypes |
getCharTypes() |
java.lang.String |
getExternalEncoding()
This method returns name of encoding that has been passed
explicitly to the reader or writer, from outside.
|
IllegalCharHandler |
getIllegalCharHandler() |
java.lang.Object |
getProperty(java.lang.String name,
boolean isMandatory) |
java.lang.String |
getPublicId() |
java.lang.String |
getSystemId() |
java.lang.String |
getXmlDeclEncoding() |
int |
getXmlDeclStandalone() |
java.lang.String |
getXmlDeclVersion() |
javax.xml.stream.XMLReporter |
getXMLReporter() |
javax.xml.stream.XMLResolver |
getXMLResolver() |
boolean |
hasInternNamesBeenEnabled() |
boolean |
hasInternNsURIsBeenEnabled() |
boolean |
isPropertySupported(java.lang.String propName) |
boolean |
isXml11() |
void |
setActualEncoding(java.lang.String actualEnc) |
void |
setIllegalCharHandler(IllegalCharHandler illegalCharHandler) |
boolean |
setProperty(java.lang.String name,
java.lang.Object value) |
void |
setXmlDeclInfo(int version,
java.lang.String xmlDeclEnc,
java.lang.String standalone) |
void |
setXmlEncoding(java.lang.String enc) |
void |
setXMLReporter(javax.xml.stream.XMLReporter r) |
void |
setXMLResolver(javax.xml.stream.XMLResolver r) |
void |
setXmlStandalone(java.lang.Boolean b) |
void |
setXmlVersion(java.lang.String version) |
void |
updateBBSymbols(ByteBasedPNameTable sym) |
void |
updateCBSymbols(CharBasedPNameTable sym) |
boolean |
willAutoCloseInput() |
boolean |
willCoalesceText() |
boolean |
willExpandEntities() |
boolean |
willInternNames() |
boolean |
willInternNsURIs() |
boolean |
willParseLazily() |
boolean |
willPreserveLocation() |
boolean |
willReportCData() |
boolean |
willSupportNamespaces() |
hasExplicitFlag, hasFlag, hasFlagBeenModified, setFlag
public static final int DEFAULT_SMALL_BUFFER_LEN
public static final int DEFAULT_CHAR_BUFFER_LEN
public static final int STANDALONE_UNKNOWN
public static final int STANDALONE_YES
public static final int STANDALONE_NO
static final int F_NS_AWARE
static final int F_COALESCING
static final int F_DTD_AWARE
static final int F_DTD_VALIDATING
static final int F_EXPAND_ENTITIES
static final int F_LAZY_PARSING
static final int F_INTERN_NAMES
static final int F_INTERN_NS_URIS
static final int F_REPORT_CDATA
static final int F_PRESERVE_LOCATION
static final int F_AUTO_CLOSE_INPUT
static final int DEFAULT_FLAGS
private static final java.util.HashMap<java.lang.String,java.lang.Object> sProperties
private final ReaderConfig.EncodingContext mEncCtxt
private final UriCanonicalizer mCanonicalizer
private final java.lang.String mPublicId
private final java.lang.String mSystemId
private final java.lang.String mExtEncoding
private java.lang.String mActualEncoding
private java.lang.String mXmlDeclVersion
private java.lang.String mXmlDeclEncoding
private int mXmlDeclStandalone
private javax.xml.stream.XMLReporter mReporter
private javax.xml.stream.XMLResolver mResolver
private IllegalCharHandler illegalCharHandler
static final java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>> _recyclerRef
ThreadLocal
contains a SoftRerefence
to a BufferRecycler
used to provide a low-cost
buffer recycling between Reader instances.protected BufferRecycler _currRecycler
private ReaderConfig(java.lang.String publicId, java.lang.String systemId, java.lang.String extEnc, ReaderConfig.EncodingContext encCtxt, int flags, int flagMods, javax.xml.stream.XMLReporter rep, javax.xml.stream.XMLResolver res, UriCanonicalizer canonicalizer)
public ReaderConfig()
public void setActualEncoding(java.lang.String actualEnc)
public void setXmlDeclInfo(int version, java.lang.String xmlDeclEnc, java.lang.String standalone)
public final void setXmlVersion(java.lang.String version)
public final void setXmlEncoding(java.lang.String enc)
public final void setXmlStandalone(java.lang.Boolean b)
public void setXMLReporter(javax.xml.stream.XMLReporter r)
public void setXMLResolver(javax.xml.stream.XMLResolver r)
public void doCoalesceText(boolean state)
public void doAutoCloseInput(boolean state)
public void doPreserveLocation(boolean state)
public void doParseLazily(boolean state)
public void doReportCData(boolean state)
public ReaderConfig createNonShared(java.lang.String publicId, java.lang.String systemId, java.lang.String extEnc)
public java.lang.String getExternalEncoding()
CommonConfig
getExternalEncoding
in class CommonConfig
public java.lang.String getActualEncoding()
getActualEncoding
in class CommonConfig
public boolean isXml11()
isXml11
in class CommonConfig
protected int findPropertyId(java.lang.String propName)
public final java.lang.Object getProperty(java.lang.String name, boolean isMandatory)
getProperty
in class CommonConfig
isMandatory
- If true, unrecognized property should
result in IllegalArgumentException
public boolean setProperty(java.lang.String name, java.lang.Object value)
setProperty
in class CommonConfig
public boolean isPropertySupported(java.lang.String propName)
isPropertySupported
in class CommonConfig
public javax.xml.stream.XMLReporter getXMLReporter()
public javax.xml.stream.XMLResolver getXMLResolver()
public boolean willExpandEntities()
public boolean willCoalesceText()
public boolean willSupportNamespaces()
public boolean willParseLazily()
public boolean willInternNames()
public boolean willInternNsURIs()
public boolean willReportCData()
public boolean willPreserveLocation()
public boolean willAutoCloseInput()
public boolean hasInternNamesBeenEnabled()
public boolean hasInternNsURIsBeenEnabled()
public java.lang.String getPublicId()
public java.lang.String getSystemId()
public java.lang.String getXmlDeclVersion()
public java.lang.String getXmlDeclEncoding()
public int getXmlDeclStandalone()
public void configureForXmlConformance()
XMLInputFactory2.configureForXmlConformance()
for
required settings for standard StAX/StAX2 properties.
Notes: Does NOT change 'performance' settings (buffer sizes, DTD caching, coalescing, interning, accurate location info).
public void configureForConvenience()
XMLInputFactory2.configureForConvenience()
for
required settings for standard StAX/StAX2 properties.public void configureForSpeed()
See XMLInputFactory2.configureForSpeed()
for
required settings for standard StAX/StAX2 properties.
public void configureForLowMemUsage()
See XMLInputFactory2.configureForLowMemUsage()
for
required settings for standard StAX/StAX2 properties.
public void configureForRoundTripping()
See XMLInputFactory2.configureForLowMemUsage()
for
required settings for standard StAX/StAX2 properties.
public java.lang.String canonicalizeURI(char[] buf, int uriLen)
public char[] allocSmallCBuffer(int minSize)
public void freeSmallCBuffer(char[] buffer)
public char[] allocMediumCBuffer(int minSize)
public void freeMediumCBuffer(char[] buffer)
public char[] allocFullCBuffer(int minSize)
public void freeFullCBuffer(char[] buffer)
public byte[] allocFullBBuffer(int minSize)
public void freeFullBBuffer(byte[] buffer)
private BufferRecycler createRecycler()
public ByteBasedPNameTable getBBSymbols()
public CharBasedPNameTable getCBSymbols()
public void updateBBSymbols(ByteBasedPNameTable sym)
public void updateCBSymbols(CharBasedPNameTable sym)
public XmlCharTypes getCharTypes()
public void setIllegalCharHandler(IllegalCharHandler illegalCharHandler)
public IllegalCharHandler getIllegalCharHandler()