Package com.fasterxml.aalto.in
Class ReaderConfig
java.lang.Object
com.fasterxml.aalto.impl.CommonConfig
com.fasterxml.aalto.in.ReaderConfig
This is the shared configuration object passed by the factory to reader,
and by reader to whoever needs it (scanners at least).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
This is a simple container class that is used to encapsulate per-factory encoding-dependant information like symbol tables. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BufferRecycler
This is the actually container of the recyclable buffers.(package private) static final ThreadLocal
<SoftReference<BufferRecycler>> ThisThreadLocal
contains ainvalid reference
SoftRerefence
BufferRecycler
used to provide a low-cost buffer recycling between Reader instances.static final int
protected static final int
These are the default settings for XMLInputFactory.static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
private IllegalCharHandler
private String
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 final UriCanonicalizer
For efficient access by qualified name, as well as uniqueness checks, namespace URIs need to be canonicalized.private final ReaderConfig.EncodingContext
A single encoding context instance is shared between all ReaderConfig instances created for readers by an input factory.private final String
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 final String
private XMLReporter
private XMLResolver
private final String
private String
private int
private String
static final int
static final int
static final int
Fields inherited from class com.fasterxml.aalto.impl.CommonConfig
_flagMods, _flags, IMPL_NAME, IMPL_VERSION
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
ReaderConfig
(String publicId, String systemId, String extEnc, ReaderConfig.EncodingContext encCtxt, int flags, int flagMods, XMLReporter rep, XMLResolver res, UriCanonicalizer canonicalizer) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
allocFullBBuffer
(int minSize) char[]
allocFullCBuffer
(int minSize) char[]
allocMediumCBuffer
(int minSize) char[]
allocSmallCBuffer
(int minSize) canonicalizeURI
(char[] buf, int uriLen) void
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
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
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
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
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).createNonShared
(String publicId, String systemId, String extEnc) private BufferRecycler
void
doAutoCloseInput
(boolean state) void
doCoalesceText
(boolean state) void
doParseLazily
(boolean state) void
doPreserveLocation
(boolean state) void
doReportCData
(boolean state) void
doRetainAttributeGeneralEntities
(boolean state) Method for enabling or disablingAaltoInputProperties.P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES
.protected int
findPropertyId
(String propName) void
freeFullBBuffer
(byte[] buffer) void
freeFullCBuffer
(char[] buffer) void
freeMediumCBuffer
(char[] buffer) void
freeSmallCBuffer
(char[] buffer) This method returns name of encoding that has been passed explicitly to the reader or writer, from outside.final Object
getProperty
(String name, boolean isMandatory) int
boolean
boolean
boolean
isPropertySupported
(String propName) boolean
isXml11()
void
setActualEncoding
(String actualEnc) void
setIllegalCharHandler
(IllegalCharHandler illegalCharHandler) boolean
setProperty
(String name, Object value) void
setXmlDeclInfo
(int version, String xmlDeclEnc, String standalone) final void
setXmlEncoding
(String enc) void
void
final void
final void
setXmlVersion
(String version) void
void
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
Accessor for checking configured state ofAaltoInputProperties.P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES
.boolean
Methods inherited from class com.fasterxml.aalto.impl.CommonConfig
hasExplicitFlag, hasFlag, hasFlagBeenModified, setFlag
-
Field Details
-
DEFAULT_SMALL_BUFFER_LEN
public static final int DEFAULT_SMALL_BUFFER_LEN- See Also:
-
DEFAULT_CHAR_BUFFER_LEN
public static final int DEFAULT_CHAR_BUFFER_LEN- See Also:
-
STANDALONE_UNKNOWN
public static final int STANDALONE_UNKNOWN- See Also:
-
STANDALONE_YES
public static final int STANDALONE_YES- See Also:
-
STANDALONE_NO
public static final int STANDALONE_NO- See Also:
-
F_NS_AWARE
protected static final int F_NS_AWARE- See Also:
-
F_COALESCING
protected static final int F_COALESCING- See Also:
-
F_DTD_AWARE
protected static final int F_DTD_AWARE- See Also:
-
F_DTD_VALIDATING
protected static final int F_DTD_VALIDATING- See Also:
-
F_EXPAND_ENTITIES
protected static final int F_EXPAND_ENTITIES- See Also:
-
F_LAZY_PARSING
protected static final int F_LAZY_PARSING- See Also:
-
F_INTERN_NAMES
protected static final int F_INTERN_NAMES- See Also:
-
F_INTERN_NS_URIS
protected static final int F_INTERN_NS_URIS- See Also:
-
F_REPORT_CDATA
protected static final int F_REPORT_CDATA- See Also:
-
F_PRESERVE_LOCATION
protected static final int F_PRESERVE_LOCATION- See Also:
-
F_AUTO_CLOSE_INPUT
protected static final int F_AUTO_CLOSE_INPUT- See Also:
-
F_RETAIN_ATTRIBUTE_GENERAL_ENTITIES
protected static final int F_RETAIN_ATTRIBUTE_GENERAL_ENTITIES- See Also:
-
DEFAULT_FLAGS
protected static final int DEFAULT_FLAGSThese are the default settings for XMLInputFactory.- See Also:
-
sProperties
-
mEncCtxt
A single encoding context instance is shared between all ReaderConfig instances created for readers by an input factory. It is used for sharing symbol tables. -
mCanonicalizer
For efficient access by qualified name, as well as uniqueness checks, namespace URIs need to be canonicalized. -
mPublicId
-
mSystemId
-
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). -
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). -
mXmlDeclVersion
-
mXmlDeclEncoding
-
mXmlDeclStandalone
private int mXmlDeclStandalone -
mReporter
-
mResolver
-
illegalCharHandler
-
_recyclerRef
ThisThreadLocal
contains ainvalid reference
SoftRerefence
BufferRecycler
used to provide a low-cost buffer recycling between Reader instances. -
_currRecycler
This is the actually container of the recyclable buffers. It is obtained via ThreadLocal/SoftReference combination, if one exists, when Config instance is created. If one does not exist, it will created first time a buffer is returned.
-
-
Constructor Details
-
ReaderConfig
private ReaderConfig(String publicId, String systemId, String extEnc, ReaderConfig.EncodingContext encCtxt, int flags, int flagMods, XMLReporter rep, XMLResolver res, UriCanonicalizer canonicalizer) -
ReaderConfig
public ReaderConfig()
-
-
Method Details
-
setActualEncoding
-
setXmlDeclInfo
-
setXmlVersion
-
setXmlEncoding
-
setXmlStandalone
-
setXMLReporter
-
setXMLResolver
-
doCoalesceText
public void doCoalesceText(boolean state) -
doAutoCloseInput
public void doAutoCloseInput(boolean state) -
doPreserveLocation
public void doPreserveLocation(boolean state) -
doParseLazily
public void doParseLazily(boolean state) -
doReportCData
public void doReportCData(boolean state) -
doRetainAttributeGeneralEntities
public void doRetainAttributeGeneralEntities(boolean state) Method for enabling or disablingAaltoInputProperties.P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES
.- Parameters:
state
- Whether to enable or disable property- Since:
- 1.3
-
getExternalEncoding
Description copied from class:CommonConfig
This method returns name of encoding that has been passed explicitly to the reader or writer, from outside. An example is that HTTP server may pass encoding as declared in HTTP headers. This should either be null (if none passed), or the same as actual encoding (which is determined from physical stream contents [for readers], or from encoder properties / configuration [for writers]- Specified by:
getExternalEncoding
in classCommonConfig
- Returns:
- Encoding that has been passed externally by the application
-
getActualEncoding
- Specified by:
getActualEncoding
in classCommonConfig
- Returns:
- Actual encoding in use, as determined by the processor.
-
isXml11
public boolean isXml11()- Specified by:
isXml11
in classCommonConfig
- Returns:
- True, if the processing will be done according to Xml 1.1 rules; false if according to xml 1.0
-
findPropertyId
-
getProperty
- Overrides:
getProperty
in classCommonConfig
- Parameters:
isMandatory
- If true, unrecognized property should result inIllegalArgumentException
-
setProperty
- Overrides:
setProperty
in classCommonConfig
- Returns:
- True, if the specified property was succesfully set to specified value; false if its value was not changed
-
isPropertySupported
- Overrides:
isPropertySupported
in classCommonConfig
-
getXMLReporter
-
getXMLResolver
-
willExpandEntities
public boolean willExpandEntities() -
willCoalesceText
public boolean willCoalesceText() -
willSupportNamespaces
public boolean willSupportNamespaces() -
willParseLazily
public boolean willParseLazily() -
willInternNames
public boolean willInternNames() -
willInternNsURIs
public boolean willInternNsURIs() -
willReportCData
public boolean willReportCData() -
willPreserveLocation
public boolean willPreserveLocation() -
willAutoCloseInput
public boolean willAutoCloseInput() -
hasInternNamesBeenEnabled
public boolean hasInternNamesBeenEnabled() -
hasInternNsURIsBeenEnabled
public boolean hasInternNsURIsBeenEnabled() -
willRetainAttributeGeneralEntities
public boolean willRetainAttributeGeneralEntities()Accessor for checking configured state ofAaltoInputProperties.P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES
.- Returns:
- Whether the property is enabled or disabled
- Since:
- 1.3
-
getPublicId
-
getSystemId
-
getXmlDeclVersion
-
getXmlDeclEncoding
-
getXmlDeclStandalone
public int getXmlDeclStandalone() -
configureForXmlConformance
public 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). SeeXMLInputFactory2.configureForXmlConformance()
for required settings for standard StAX/StAX2 properties.Notes: Does NOT change 'performance' settings (buffer sizes, DTD caching, coalescing, interning, accurate location info).
-
configureForConvenience
public 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. This may incur some slight performance penalties, but should not affect XML conformance. SeeXMLInputFactory2.configureForConvenience()
for required settings for standard StAX/StAX2 properties. -
configureForSpeed
public 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.See
XMLInputFactory2.configureForSpeed()
for required settings for standard StAX/StAX2 properties. -
configureForLowMemUsage
public 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. This generally incurs some performance penalties, due to using smaller input buffers.See
XMLInputFactory2.configureForLowMemUsage()
for required settings for standard StAX/StAX2 properties. -
configureForRoundTripping
public 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.See
XMLInputFactory2.configureForLowMemUsage()
for required settings for standard StAX/StAX2 properties. -
canonicalizeURI
-
allocSmallCBuffer
public char[] allocSmallCBuffer(int minSize) -
freeSmallCBuffer
public void freeSmallCBuffer(char[] buffer) -
allocMediumCBuffer
public char[] allocMediumCBuffer(int minSize) -
freeMediumCBuffer
public void freeMediumCBuffer(char[] buffer) -
allocFullCBuffer
public char[] allocFullCBuffer(int minSize) -
freeFullCBuffer
public void freeFullCBuffer(char[] buffer) -
allocFullBBuffer
public byte[] allocFullBBuffer(int minSize) -
freeFullBBuffer
public void freeFullBBuffer(byte[] buffer) -
createRecycler
-
getBBSymbols
-
getCBSymbols
-
updateBBSymbols
-
updateCBSymbols
-
getCharTypes
-
setIllegalCharHandler
-
getIllegalCharHandler
-