Package com.fasterxml.aalto.out
Class WriterConfig
- java.lang.Object
-
- com.fasterxml.aalto.impl.CommonConfig
-
- com.fasterxml.aalto.out.WriterConfig
-
public final class WriterConfig extends CommonConfig
This is the shared configuration object passed by the factory to writer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
WriterConfig.EncodingContext
This is a simple container class that is used to encapsulate per-factory encoding-dependant information like symbol tables.
-
Field Summary
Fields Modifier and Type Field Description (package private) BufferRecycler
_currRecycler
This is the actually container of the recyclable buffers.private java.lang.String
_encoding
Encoding passed in either during construction, or via xml declaration write.private WriterConfig.EncodingContext
_encodingContext
A single encoding context instance is shared between all WriterConfig instances created for readers by an output factory.private java.lang.String
_propAutoNsPrefix
protected static java.lang.String
DEFAULT_AUTOMATIC_NS_PREFIX
(package private) static int
DEFAULT_FLAGS
(package private) static int
F_AUTO_CLOSE_OUTPUT
(package private) static int
F_AUTO_EMPTY_ELEMS
(package private) static int
F_NS_AWARE
(package private) static int
F_NS_REPAIRING
(package private) static java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>>
mRecyclerRef
ThisThreadLocal
contains aSoftRerefence
to aBufferRecycler
used to provide a low-cost buffer recycling between Reader instances.(package private) static int
PROP_AUTO_NS_PREFIX
private static java.util.HashMap<java.lang.String,java.lang.Integer>
sProperties
-
Fields inherited from class com.fasterxml.aalto.impl.CommonConfig
_flagMods, _flags, IMPL_NAME, IMPL_VERSION
-
-
Constructor Summary
Constructors Modifier Constructor Description WriterConfig()
private
WriterConfig(java.lang.String encoding, int flags, int flagMods, WriterConfig.EncodingContext encCtxt, java.lang.String autoNsPrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
allocFullBBuffer(int minSize)
char[]
allocFullCBuffer(int minSize)
char[]
allocMediumCBuffer(int minSize)
void
configureForRobustness()
void
configureForSpeed()
For Woodstox, setting this profile disables most checks for validity; specifically anything that can have measurable performance impact.void
configureForXmlConformance()
WriterConfig
createNonShared()
private BufferRecycler
createRecycler()
void
doAutoCloseOutput(boolean state)
void
enableXml11()
void
freeFullBBuffer(byte[] buffer)
void
freeFullCBuffer(char[] buffer)
void
freeMediumCBuffer(char[] buffer)
java.lang.String
getActualEncoding()
WNameTable
getAsciiSymbols(WNameFactory f)
java.lang.String
getAutomaticNsPrefix()
WNameTable
getCharSymbols(WNameFactory f)
java.lang.String
getExternalEncoding()
This method returns name of encoding that has been passed explicitly to the reader or writer, from outside.WNameTable
getLatin1Symbols(WNameFactory f)
java.lang.String
getPreferredEncoding()
java.lang.Object
getProperty(java.lang.String name, boolean isMandatory)
WNameTable
getUtf8Symbols(WNameFactory f)
boolean
isNamespaceAware()
boolean
isPropertySupported(java.lang.String propName)
boolean
isXml11()
void
setActualEncodingIfNotSet(java.lang.String enc)
boolean
setProperty(java.lang.String name, java.lang.Object value)
boolean
willAutoCloseOutput()
boolean
willCheckAttributes()
boolean
willCheckContent()
boolean
willCheckNames()
boolean
willCheckStructure()
boolean
willEscapeCR()
boolean
willFixContent()
boolean
willRepairNamespaces()
-
Methods inherited from class com.fasterxml.aalto.impl.CommonConfig
hasExplicitFlag, hasFlag, hasFlagBeenModified, setFlag
-
-
-
-
Field Detail
-
DEFAULT_AUTOMATIC_NS_PREFIX
protected static final java.lang.String DEFAULT_AUTOMATIC_NS_PREFIX
- See Also:
- Constant Field Values
-
F_NS_REPAIRING
static final int F_NS_REPAIRING
- See Also:
- Constant Field Values
-
F_AUTO_CLOSE_OUTPUT
static final int F_AUTO_CLOSE_OUTPUT
- See Also:
- Constant Field Values
-
F_NS_AWARE
static final int F_NS_AWARE
- See Also:
- Constant Field Values
-
F_AUTO_EMPTY_ELEMS
static final int F_AUTO_EMPTY_ELEMS
- See Also:
- Constant Field Values
-
PROP_AUTO_NS_PREFIX
static final int PROP_AUTO_NS_PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_FLAGS
static final int DEFAULT_FLAGS
- See Also:
- Constant Field Values
-
sProperties
private static final java.util.HashMap<java.lang.String,java.lang.Integer> sProperties
-
_propAutoNsPrefix
private java.lang.String _propAutoNsPrefix
-
_encodingContext
private final WriterConfig.EncodingContext _encodingContext
A single encoding context instance is shared between all WriterConfig instances created for readers by an output factory. It is used for sharing symbol tables.
-
_encoding
private java.lang.String _encoding
Encoding passed in either during construction, or via xml declaration write.
-
mRecyclerRef
static final java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>> mRecyclerRef
ThisThreadLocal
contains aSoftRerefence
to aBufferRecycler
used to provide a low-cost buffer recycling between Reader instances.
-
_currRecycler
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
-
WriterConfig
private WriterConfig(java.lang.String encoding, int flags, int flagMods, WriterConfig.EncodingContext encCtxt, java.lang.String autoNsPrefix)
-
WriterConfig
public WriterConfig()
-
-
Method Detail
-
setActualEncodingIfNotSet
public void setActualEncodingIfNotSet(java.lang.String enc)
-
doAutoCloseOutput
public void doAutoCloseOutput(boolean state)
-
enableXml11
public void enableXml11()
-
createNonShared
public WriterConfig createNonShared()
-
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
-
getExternalEncoding
public java.lang.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 classCommonConfig
- Returns:
- Encoding that has been passed externally by the application
-
getActualEncoding
public java.lang.String getActualEncoding()
- Specified by:
getActualEncoding
in classCommonConfig
- Returns:
- Actual encoding in use, as determined by the processor.
-
getPreferredEncoding
public java.lang.String getPreferredEncoding()
-
getProperty
public java.lang.Object getProperty(java.lang.String name, boolean isMandatory)
- Overrides:
getProperty
in classCommonConfig
isMandatory
- If true, unrecognized property should result inIllegalArgumentException
-
setProperty
public boolean setProperty(java.lang.String name, java.lang.Object value)
- Overrides:
setProperty
in classCommonConfig
- Returns:
- True, if the specified property was succesfully set to specified value; false if its value was not changed
-
isPropertySupported
public boolean isPropertySupported(java.lang.String propName)
- Overrides:
isPropertySupported
in classCommonConfig
-
willRepairNamespaces
public boolean willRepairNamespaces()
-
isNamespaceAware
public boolean isNamespaceAware()
-
willAutoCloseOutput
public boolean willAutoCloseOutput()
-
getAutomaticNsPrefix
public java.lang.String getAutomaticNsPrefix()
- Returns:
- Prefix to use as the base for automatically generated namespace prefixes ("namespace prefix prefix", so to speak). Defaults to "axns".
-
configureForXmlConformance
public void configureForXmlConformance()
-
configureForRobustness
public void configureForRobustness()
-
configureForSpeed
public void configureForSpeed()
For Woodstox, setting this profile disables most checks for validity; specifically anything that can have measurable performance impact.
-
willCheckStructure
public boolean willCheckStructure()
-
willCheckContent
public boolean willCheckContent()
-
willCheckNames
public boolean willCheckNames()
-
willCheckAttributes
public boolean willCheckAttributes()
-
willFixContent
public boolean willFixContent()
-
willEscapeCR
public boolean willEscapeCR()
-
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
private BufferRecycler createRecycler()
-
getUtf8Symbols
public WNameTable getUtf8Symbols(WNameFactory f)
-
getLatin1Symbols
public WNameTable getLatin1Symbols(WNameFactory f)
-
getAsciiSymbols
public WNameTable getAsciiSymbols(WNameFactory f)
-
getCharSymbols
public WNameTable getCharSymbols(WNameFactory f)
-
-