Top Description Inners Fields Constructors Methods
com.fasterxml.aalto.in

public final Class ReaderConfig

extends CommonConfig
Class Inheritance
Imports
java.lang.ref.SoftReference, java.util.*, javax.xml.stream.*, com.fasterxml.aalto.AaltoInputProperties, org.codehaus.stax2.XMLInputFactory2, com.fasterxml.aalto.impl.CommonConfig, com.fasterxml.aalto.util.*

This is the shared configuration object passed by the factory to reader, and by reader to whoever needs it (scanners at least).

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
ReaderConfig.EncodingContext

This is a simple container class that is used to encapsulate per-factory encoding-dependant information like symbol tables.

Field Summary

Modifier and TypeField and Description
protected BufferRecycler
_currRecycler

This is the actually container of the recyclable buffers.

pack-priv static final ThreadLocal<SoftReference<BufferRecycler>>
_recyclerRef

This ThreadLocal contains a SoftRerefence to a BufferRecycler used to provide a low-cost buffer recycling between Reader instances.

public static final int
protected static final int
DEFAULT_FLAGS

These are the default settings for XMLInputFactory.

public 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
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 final UriCanonicalizer
mCanonicalizer

For efficient access by qualified name, as well as uniqueness checks, namespace URIs need to be canonicalized.

private final ReaderConfig.EncodingContext
mEncCtxt

A single encoding context instance is shared between all ReaderConfig instances created for readers by an input factory.

private final 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 final String
private XMLReporter
private XMLResolver
private final String
private String
private int
private String
private static final HashMap<String, Object>
public static final int
public static final int
public static final int
Inherited from com.fasterxml.aalto.impl.CommonConfig:
_flagMods_flagsIMPL_NAMEIMPL_VERSION

Constructor Summary

AccessConstructor and Description
private
ReaderConfig(String publicId, String systemId, String extEnc, ReaderConfig.EncodingContext encCtxt, int flags, int flagMods, XMLReporter rep, XMLResolver res, UriCanonicalizer canonicalizer)

public

Method Summary

Modifier and TypeMethod and Description
public byte[]
allocFullBBuffer(int minSize)

public char[]
allocFullCBuffer(int minSize)

public char[]
allocMediumCBuffer(int minSize)

public char[]
allocSmallCBuffer(int minSize)

public String
canonicalizeURI(char[] buf, int uriLen)

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.

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.

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.

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.

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).

public ReaderConfig
createNonShared(String publicId, String systemId, String extEnc)

private BufferRecycler
public void
doAutoCloseInput(boolean state)

public void
doCoalesceText(boolean state)

public void
doParseLazily(boolean state)

public void
doPreserveLocation(boolean state)

public void
doReportCData(boolean state)

public void
doRetainAttributeGeneralEntities(boolean
Whether to enable or disable property
state
)

Method for enabling or disabling AaltoInputProperties#P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES.

protected int
public void
freeFullBBuffer(byte[] buffer)

public void
freeFullCBuffer(char[] buffer)

public void
freeMediumCBuffer(char[] buffer)

public void
freeSmallCBuffer(char[] buffer)

public String
public ByteBasedPNameTable
public CharBasedPNameTable
public XmlCharTypes
public String
getExternalEncoding()

Implements abstract com.fasterxml.aalto.impl.CommonConfig.getExternalEncoding.

This method returns name of encoding that has been passed explicitly to the reader or writer, from outside.
public IllegalCharHandler
public final Object
getProperty(String name, boolean
If true, unrecognized property should result in IllegalArgumentException
isMandatory
)

Overrides com.fasterxml.aalto.impl.CommonConfig.getProperty.

public String
public String
public String
public int
public String
public XMLReporter
public XMLResolver
public boolean
public boolean
public boolean
public boolean
public void
public void
public boolean
public void
setXmlDeclInfo(int version, String xmlDeclEnc, String standalone)

public final void
public void
public void
public final void
public final void
public void
public void
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean

Returns:

Whether the property is enabled or disabled
willRetainAttributeGeneralEntities
()

Accessor for checking configured state of AaltoInputProperties#P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES.

public boolean
Inherited from com.fasterxml.aalto.impl.CommonConfig:
hasExplicitFlaghasFlaghasFlagBeenModifiedsetFlag

Field Detail

_currRecyclerback to summary
protected BufferRecycler _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.

_recyclerRefback to summary
pack-priv static final ThreadLocal<SoftReference<BufferRecycler>> _recyclerRef

This ThreadLocal contains a SoftRerefence to a BufferRecycler used to provide a low-cost buffer recycling between Reader instances.

DEFAULT_CHAR_BUFFER_LENback to summary
public static final int DEFAULT_CHAR_BUFFER_LEN
DEFAULT_FLAGSback to summary
protected static final int DEFAULT_FLAGS

These are the default settings for XMLInputFactory.

DEFAULT_SMALL_BUFFER_LENback to summary
public static final int DEFAULT_SMALL_BUFFER_LEN
F_AUTO_CLOSE_INPUTback to summary
protected static final int F_AUTO_CLOSE_INPUT
F_COALESCINGback to summary
protected static final int F_COALESCING
F_DTD_AWAREback to summary
protected static final int F_DTD_AWARE
F_DTD_VALIDATINGback to summary
protected static final int F_DTD_VALIDATING
F_EXPAND_ENTITIESback to summary
protected static final int F_EXPAND_ENTITIES
F_INTERN_NAMESback to summary
protected static final int F_INTERN_NAMES
F_INTERN_NS_URISback to summary
protected static final int F_INTERN_NS_URIS
F_LAZY_PARSINGback to summary
protected static final int F_LAZY_PARSING
F_NS_AWAREback to summary
protected static final int F_NS_AWARE
F_PRESERVE_LOCATIONback to summary
protected static final int F_PRESERVE_LOCATION
F_REPORT_CDATAback to summary
protected static final int F_REPORT_CDATA
F_RETAIN_ATTRIBUTE_GENERAL_ENTITIESback to summary
protected static final int F_RETAIN_ATTRIBUTE_GENERAL_ENTITIES
illegalCharHandlerback to summary
private IllegalCharHandler illegalCharHandler
mActualEncodingback to summary
private 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).

mCanonicalizerback to summary
private final UriCanonicalizer mCanonicalizer

For efficient access by qualified name, as well as uniqueness checks, namespace URIs need to be canonicalized.

mEncCtxtback to summary
private final ReaderConfig.EncodingContext 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.

mExtEncodingback to summary
private final 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).

mPublicIdback to summary
private final String mPublicId
mReporterback to summary
private XMLReporter mReporter
mResolverback to summary
private XMLResolver mResolver
mSystemIdback to summary
private final String mSystemId
mXmlDeclEncodingback to summary
private String mXmlDeclEncoding
mXmlDeclStandaloneback to summary
private int mXmlDeclStandalone
mXmlDeclVersionback to summary
private String mXmlDeclVersion
sPropertiesback to summary
private static final HashMap<String, Object> sProperties
STANDALONE_NOback to summary
public static final int STANDALONE_NO
STANDALONE_UNKNOWNback to summary
public static final int STANDALONE_UNKNOWN
STANDALONE_YESback to summary
public static final int STANDALONE_YES

Constructor Detail

ReaderConfigback to summary
private ReaderConfig(String publicId, String systemId, String extEnc, ReaderConfig.EncodingContext encCtxt, int flags, int flagMods, XMLReporter rep, XMLResolver res, UriCanonicalizer canonicalizer)
ReaderConfigback to summary
public ReaderConfig()

Method Detail

allocFullBBufferback to summary
public byte[] allocFullBBuffer(int minSize)
allocFullCBufferback to summary
public char[] allocFullCBuffer(int minSize)
allocMediumCBufferback to summary
public char[] allocMediumCBuffer(int minSize)
allocSmallCBufferback to summary
public char[] allocSmallCBuffer(int minSize)
canonicalizeURIback to summary
public String canonicalizeURI(char[] buf, int uriLen)
configureForConvenienceback to summary
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. See XMLInputFactory2#configureForConvenience for required settings for standard StAX/StAX2 properties.

configureForLowMemUsageback to summary
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.

configureForRoundTrippingback to summary
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.

configureForSpeedback to summary
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.

configureForXmlConformanceback to summary
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). See 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).

createNonSharedback to summary
public ReaderConfig createNonShared(String publicId, String systemId, String extEnc)
createRecyclerback to summary
private BufferRecycler createRecycler()
doAutoCloseInputback to summary
public void doAutoCloseInput(boolean state)
doCoalesceTextback to summary
public void doCoalesceText(boolean state)
doParseLazilyback to summary
public void doParseLazily(boolean state)
doPreserveLocationback to summary
public void doPreserveLocation(boolean state)
doReportCDataback to summary
public void doReportCData(boolean state)
doRetainAttributeGeneralEntitiesback to summary
public void doRetainAttributeGeneralEntities(boolean state)

Method for enabling or disabling AaltoInputProperties#P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES.

Parameters
state:boolean

Whether to enable or disable property

Since
1.3
findPropertyIdback to summary
protected int findPropertyId(String propName)
freeFullBBufferback to summary
public void freeFullBBuffer(byte[] buffer)
freeFullCBufferback to summary
public void freeFullCBuffer(char[] buffer)
freeMediumCBufferback to summary
public void freeMediumCBuffer(char[] buffer)
freeSmallCBufferback to summary
public void freeSmallCBuffer(char[] buffer)
getActualEncodingback to summary
public String getActualEncoding()

Implements abstract com.fasterxml.aalto.impl.CommonConfig.getActualEncoding.

Returns:String

Doc from com.fasterxml.aalto.impl.CommonConfig.getActualEncoding.

Actual encoding in use, as determined by the processor.

Annotations
@Override
getBBSymbolsback to summary
public ByteBasedPNameTable getBBSymbols()
getCBSymbolsback to summary
public CharBasedPNameTable getCBSymbols()
getCharTypesback to summary
public XmlCharTypes getCharTypes()
getExternalEncodingback to summary
public String getExternalEncoding()

Implements abstract com.fasterxml.aalto.impl.CommonConfig.getExternalEncoding.

Doc from com.fasterxml.aalto.impl.CommonConfig.getExternalEncoding.

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]

Returns:String

Encoding that has been passed externally by the application

Annotations
@Override
getIllegalCharHandlerback to summary
public IllegalCharHandler getIllegalCharHandler()
getPropertyback to summary
public final Object getProperty(String name, boolean isMandatory)

Overrides com.fasterxml.aalto.impl.CommonConfig.getProperty.

Parameters
isMandatory:boolean

Doc from com.fasterxml.aalto.impl.CommonConfig.getProperty.

If true, unrecognized property should result in IllegalArgumentException

Annotations
@Override
getPublicIdback to summary
public String getPublicId()
getSystemIdback to summary
public String getSystemId()
getXmlDeclEncodingback to summary
public String getXmlDeclEncoding()
getXmlDeclStandaloneback to summary
public int getXmlDeclStandalone()
getXmlDeclVersionback to summary
public String getXmlDeclVersion()
getXMLReporterback to summary
public XMLReporter getXMLReporter()
getXMLResolverback to summary
public XMLResolver getXMLResolver()
hasInternNamesBeenEnabledback to summary
public boolean hasInternNamesBeenEnabled()
hasInternNsURIsBeenEnabledback to summary
public boolean hasInternNsURIsBeenEnabled()
isPropertySupportedback to summary
public boolean isPropertySupported(String propName)

Overrides com.fasterxml.aalto.impl.CommonConfig.isPropertySupported.

Annotations
@Override
isXml11back to summary
public boolean isXml11()

Implements abstract com.fasterxml.aalto.impl.CommonConfig.isXml11.

Returns:boolean

Doc from com.fasterxml.aalto.impl.CommonConfig.isXml11.

True, if the processing will be done according to Xml 1.1 rules; false if according to xml 1.0

Annotations
@Override
setActualEncodingback to summary
public void setActualEncoding(String actualEnc)
setIllegalCharHandlerback to summary
public void setIllegalCharHandler(IllegalCharHandler illegalCharHandler)
setPropertyback to summary
public boolean setProperty(String name, Object value)

Overrides com.fasterxml.aalto.impl.CommonConfig.setProperty.

Returns:boolean

Doc from com.fasterxml.aalto.impl.CommonConfig.setProperty.

True, if the specified property was succesfully set to specified value; false if its value was not changed

Annotations
@Override
setXmlDeclInfoback to summary
public void setXmlDeclInfo(int version, String xmlDeclEnc, String standalone)
setXmlEncodingback to summary
public final void setXmlEncoding(String enc)
setXMLReporterback to summary
public void setXMLReporter(XMLReporter r)
setXMLResolverback to summary
public void setXMLResolver(XMLResolver r)
setXmlStandaloneback to summary
public final void setXmlStandalone(Boolean b)
setXmlVersionback to summary
public final void setXmlVersion(String version)
updateBBSymbolsback to summary
public void updateBBSymbols(ByteBasedPNameTable sym)
updateCBSymbolsback to summary
public void updateCBSymbols(CharBasedPNameTable sym)
willAutoCloseInputback to summary
public boolean willAutoCloseInput()
willCoalesceTextback to summary
public boolean willCoalesceText()
willExpandEntitiesback to summary
public boolean willExpandEntities()
willInternNamesback to summary
public boolean willInternNames()
willInternNsURIsback to summary
public boolean willInternNsURIs()
willParseLazilyback to summary
public boolean willParseLazily()
willPreserveLocationback to summary
public boolean willPreserveLocation()
willReportCDataback to summary
public boolean willReportCData()
willRetainAttributeGeneralEntitiesback to summary
public boolean willRetainAttributeGeneralEntities()

Accessor for checking configured state of AaltoInputProperties#P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES.

Returns:boolean

Whether the property is enabled or disabled

Since
1.3
willSupportNamespacesback to summary
public boolean willSupportNamespaces()
com.fasterxml.aalto.in back to summary

pack-priv final Class ReaderConfig.EncodingContext

extends Object
Class Inheritance

This is a simple container class that is used to encapsulate per-factory encoding-dependant information like symbol tables.

Field Summary

Modifier and TypeField and Description
pack-priv ByteBasedPNameTable
pack-priv CharBasedPNameTable
mGeneralTable

If there is no encoding to worry about, we only need a single symbol table.

pack-priv ByteBasedPNameTable
pack-priv ByteBasedPNameTable

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public synchronized ByteBasedPNameTable
public synchronized ByteBasedPNameTable
public synchronized CharBasedPNameTable
public synchronized ByteBasedPNameTable
public synchronized void
public synchronized void
public synchronized void
public synchronized void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mAsciiTableback to summary
pack-priv ByteBasedPNameTable mAsciiTable
mGeneralTableback to summary
pack-priv CharBasedPNameTable mGeneralTable

If there is no encoding to worry about, we only need a single symbol table.

mLatin1Tableback to summary
pack-priv ByteBasedPNameTable mLatin1Table
mUtf8Tableback to summary
pack-priv ByteBasedPNameTable mUtf8Table

Constructor Detail

EncodingContextback to summary
pack-priv EncodingContext()

Method Detail

getAsciiSymbolsback to summary
public synchronized ByteBasedPNameTable getAsciiSymbols()
getLatin1Symbolsback to summary
public synchronized ByteBasedPNameTable getLatin1Symbols()
getSymbolsback to summary
public synchronized CharBasedPNameTable getSymbols()
getUtf8Symbolsback to summary
public synchronized ByteBasedPNameTable getUtf8Symbols()
updateAsciiSymbolsback to summary
public synchronized void updateAsciiSymbols(ByteBasedPNameTable sym)
updateLatin1Symbolsback to summary
public synchronized void updateLatin1Symbols(ByteBasedPNameTable sym)
updateSymbolsback to summary
public synchronized void updateSymbols(CharBasedPNameTable sym)
updateUtf8Symbolsback to summary
public synchronized void updateUtf8Symbols(ByteBasedPNameTable sym)