com.fasterxml.aalto.in
Class ReaderConfig

java.lang.Object
  extended by com.fasterxml.aalto.impl.CommonConfig
      extended by com.fasterxml.aalto.in.ReaderConfig

public final class ReaderConfig
extends CommonConfig

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


Field Summary
protected  BufferRecycler _currRecycler
          This is the actually container of the recyclable buffers.
static int DEFAULT_CHAR_BUFFER_LEN
           
static int DEFAULT_SMALL_BUFFER_LEN
           
static int STANDALONE_NO
           
static int STANDALONE_UNKNOWN
           
static int STANDALONE_YES
           
 
Fields inherited from class com.fasterxml.aalto.impl.CommonConfig
_flagMods, _flags, IMPL_NAME, IMPL_VERSION
 
Constructor Summary
ReaderConfig()
           
 
Method Summary
 byte[] allocFullBBuffer(int minSize)
           
 char[] allocFullCBuffer(int minSize)
           
 char[] allocMediumCBuffer(int minSize)
           
 char[] allocSmallCBuffer(int minSize)
           
 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(String publicId, String systemId, String extEnc)
           
 void doAutoCloseInput(boolean state)
           
 void doCoalesceText(boolean state)
           
 void doParseLazily(boolean state)
           
 void doPreserveLocation(boolean state)
           
 void doReportCData(boolean state)
           
protected  int findPropertyId(String propName)
           
 void freeFullBBuffer(byte[] buffer)
           
 void freeFullCBuffer(char[] buffer)
           
 void freeMediumCBuffer(char[] buffer)
           
 void freeSmallCBuffer(char[] buffer)
           
 String getActualEncoding()
           
 ByteBasedPNameTable getBBSymbols()
           
 CharBasedPNameTable getCBSymbols()
           
 XmlCharTypes getCharTypes()
           
 String getExternalEncoding()
          This method returns name of encoding that has been passed explicitly to the reader or writer, from outside.
 Object getProperty(String name, boolean isMandatory)
           
 String getPublicId()
           
 String getSystemId()
           
 String getXmlDeclEncoding()
           
 int getXmlDeclStandalone()
           
 String getXmlDeclVersion()
           
 XMLReporter getXMLReporter()
           
 XMLResolver getXMLResolver()
           
 boolean hasInternNamesBeenEnabled()
           
 boolean hasInternNsURIsBeenEnabled()
           
 boolean isPropertySupported(String propName)
           
 boolean isXml11()
           
 void setActualEncoding(String actualEnc)
           
 boolean setProperty(String name, Object value)
           
 void setXmlDeclInfo(int version, String xmlDeclEnc, String standalone)
           
 void setXmlEncoding(String enc)
           
 void setXMLReporter(XMLReporter r)
           
 void setXMLResolver(XMLResolver r)
           
 void setXmlStandalone(Boolean b)
           
 void setXmlVersion(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()
           
 
Methods inherited from class com.fasterxml.aalto.impl.CommonConfig
hasExplicitFlag, hasFlag, hasFlagBeenModified, setFlag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SMALL_BUFFER_LEN

public static final int DEFAULT_SMALL_BUFFER_LEN
See Also:
Constant Field Values

DEFAULT_CHAR_BUFFER_LEN

public static final int DEFAULT_CHAR_BUFFER_LEN
See Also:
Constant Field Values

STANDALONE_UNKNOWN

public static final int STANDALONE_UNKNOWN
See Also:
Constant Field Values

STANDALONE_YES

public static final int STANDALONE_YES
See Also:
Constant Field Values

STANDALONE_NO

public static final int STANDALONE_NO
See Also:
Constant Field Values

_currRecycler

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.

Constructor Detail

ReaderConfig

public ReaderConfig()
Method Detail

setActualEncoding

public void setActualEncoding(String actualEnc)

setXmlDeclInfo

public void setXmlDeclInfo(int version,
                           String xmlDeclEnc,
                           String standalone)

setXmlVersion

public final void setXmlVersion(String version)

setXmlEncoding

public final void setXmlEncoding(String enc)

setXmlStandalone

public final void setXmlStandalone(Boolean b)

setXMLReporter

public void setXMLReporter(XMLReporter r)

setXMLResolver

public void setXMLResolver(XMLResolver r)

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)

createNonShared

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

getExternalEncoding

public String 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 class CommonConfig
Returns:
Encoding that has been passed externally by the application

getActualEncoding

public String getActualEncoding()
Specified by:
getActualEncoding in class CommonConfig
Returns:
Actual encoding in use, as determined by the processor.

isXml11

public boolean isXml11()
Specified by:
isXml11 in class CommonConfig
Returns:
True, if the processing will be done according to Xml 1.1 rules; false if according to xml 1.0

findPropertyId

protected int findPropertyId(String propName)

getProperty

public final Object getProperty(String name,
                                boolean isMandatory)
Overrides:
getProperty in class CommonConfig
isMandatory - If true, unrecognized property should result in IllegalArgumentException

setProperty

public boolean setProperty(String name,
                           Object value)
Overrides:
setProperty in class CommonConfig
Returns:
True, if the specified property was succesfully set to specified value; false if its value was not changed

isPropertySupported

public boolean isPropertySupported(String propName)
Overrides:
isPropertySupported in class CommonConfig

getXMLReporter

public XMLReporter getXMLReporter()

getXMLResolver

public XMLResolver 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()

getPublicId

public String getPublicId()

getSystemId

public String getSystemId()

getXmlDeclVersion

public String getXmlDeclVersion()

getXmlDeclEncoding

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


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. See XMLInputFactory2.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

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

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)

getBBSymbols

public ByteBasedPNameTable getBBSymbols()

getCBSymbols

public CharBasedPNameTable getCBSymbols()

updateBBSymbols

public void updateBBSymbols(ByteBasedPNameTable sym)

updateCBSymbols

public void updateCBSymbols(CharBasedPNameTable sym)

getCharTypes

public XmlCharTypes getCharTypes()


Copyright © 2012 Fasterxml.com. All Rights Reserved.