Class YAMLFactory
- java.lang.Object
-
- com.fasterxml.jackson.core.TokenStreamFactory
-
- com.fasterxml.jackson.core.JsonFactory
-
- com.fasterxml.jackson.dataformat.yaml.YAMLFactory
-
- All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned
,java.io.Serializable
public class YAMLFactory extends com.fasterxml.jackson.core.JsonFactory
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected org.yaml.snakeyaml.DumperOptions
_dumperOptions
Configuration for underlying generator to follow, if specified; left asnull
for backwards compatibility (which means the dumper options are derived based onYAMLGenerator.Feature
s).protected org.yaml.snakeyaml.LoaderOptions
_loaderOptions
Configuration for underlying parser to follow, if specified; left asnull
for backwards compatibility (which means whatever default settingsSnakeYAML
deems best).protected StringQuotingChecker
_quotingChecker
Helper object used to determine whether property names, String values must be quoted or not.protected org.yaml.snakeyaml.DumperOptions.Version
_version
YAML version for underlying generator to follow, if specified.protected int
_yamlGeneratorFeatures
protected int
_yamlParserFeatures
protected static int
DEFAULT_YAML_GENERATOR_FEATURE_FLAGS
Bitfield (set of flags) of all generator features that are enabled by default.protected static int
DEFAULT_YAML_PARSER_FEATURE_FLAGS
Bitfield (set of flags) of all parser features that are enabled by default.static java.lang.String
FORMAT_NAME_YAML
Name used to identify YAML format.private static long
serialVersionUID
private static byte
UTF8_BOM_1
private static byte
UTF8_BOM_2
private static byte
UTF8_BOM_3
-
Fields inherited from class com.fasterxml.jackson.core.JsonFactory
_byteSymbolCanonicalizer, _characterEscapes, _errorReportConfiguration, _factoryFeatures, _generatorDecorators, _generatorFeatures, _inputDecorator, _maximumNonEscapedChar, _objectCodec, _outputDecorator, _parserFeatures, _quoteChar, _recyclerPool, _rootCharSymbols, _rootValueSeparator, _streamReadConstraints, _streamWriteConstraints, DEFAULT_FACTORY_FEATURE_FLAGS, DEFAULT_GENERATOR_FEATURE_FLAGS, DEFAULT_PARSER_FEATURE_FLAGS, DEFAULT_QUOTE_CHAR, DEFAULT_ROOT_VALUE_SEPARATOR, FORMAT_NAME_JSON
-
-
Constructor Summary
Constructors Modifier Constructor Description YAMLFactory()
Default constructor used to create factory instances.YAMLFactory(com.fasterxml.jackson.core.ObjectCodec oc)
protected
YAMLFactory(YAMLFactoryBuilder b)
Constructors used byYAMLFactoryBuilder
for instantiation.YAMLFactory(YAMLFactory src, com.fasterxml.jackson.core.ObjectCodec oc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected YAMLGenerator
_createGenerator(java.io.Writer out, com.fasterxml.jackson.core.io.IOContext ctxt)
protected YAMLParser
_createParser(byte[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt)
protected YAMLParser
_createParser(char[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt, boolean recyclable)
protected YAMLParser
_createParser(java.io.InputStream in, com.fasterxml.jackson.core.io.IOContext ctxt)
protected YAMLParser
_createParser(java.io.Reader r, com.fasterxml.jackson.core.io.IOContext ctxt)
protected java.io.Reader
_createReader(byte[] data, int offset, int len, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt)
protected java.io.Reader
_createReader(java.io.InputStream in, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt)
protected YAMLGenerator
_createUTF8Generator(java.io.OutputStream out, com.fasterxml.jackson.core.io.IOContext ctxt)
protected java.io.Writer
_createWriter(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt)
static YAMLFactoryBuilder
builder()
Main factory method to use for constructingYAMLFactory
instances with different configuration.boolean
canUseCharArrays()
YAMLFactory
configure(YAMLGenerator.Feature f, boolean state)
Method for enabling or disabling specified generator feature (checkYAMLGenerator.Feature
for list of features)YAMLFactory
configure(YAMLParser.Feature f, boolean state)
Method for enabling or disabling specified parser feature (checkYAMLParser.Feature
for list of features)YAMLFactory
copy()
com.fasterxml.jackson.core.JsonGenerator
createGenerator(java.io.File f, com.fasterxml.jackson.core.JsonEncoding enc)
YAMLGenerator
createGenerator(java.io.OutputStream out)
YAMLGenerator
createGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc)
YAMLGenerator
createGenerator(java.io.Writer out)
YAMLParser
createParser(byte[] data)
YAMLParser
createParser(byte[] data, int offset, int len)
YAMLParser
createParser(char[] data)
YAMLParser
createParser(char[] data, int offset, int len)
YAMLParser
createParser(java.io.File f)
YAMLParser
createParser(java.io.InputStream in)
YAMLParser
createParser(java.io.Reader r)
YAMLParser
createParser(java.lang.String content)
YAMLParser
createParser(java.net.URL url)
YAMLFactory
disable(YAMLGenerator.Feature f)
Method for disabling specified generator feature (checkYAMLGenerator.Feature
for list of features)YAMLFactory
disable(YAMLParser.Feature f)
Method for disabling specified parser features (checkYAMLParser.Feature
for list of features)YAMLFactory
enable(YAMLGenerator.Feature f)
Method for enabling specified generator features (checkYAMLGenerator.Feature
for list of features)YAMLFactory
enable(YAMLParser.Feature f)
Method for enabling specified parser feature (checkYAMLParser.Feature
for list of features)int
getFormatGeneratorFeatures()
java.lang.String
getFormatName()
int
getFormatParserFeatures()
java.lang.Class<YAMLParser.Feature>
getFormatReadFeatureType()
java.lang.Class<YAMLGenerator.Feature>
getFormatWriteFeatureType()
com.fasterxml.jackson.core.format.MatchStrength
hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc)
Sub-classes need to override this methodboolean
isEnabled(YAMLGenerator.Feature f)
Check whether specified generator feature is enabled.boolean
isEnabled(YAMLParser.Feature f)
Checked whether specified parser feature is enabled.protected java.lang.Object
readResolve()
Method that we need to override to actually make restoration go through constructors etc.YAMLFactoryBuilder
rebuild()
com.fasterxml.jackson.core.Version
version()
-
Methods inherited from class com.fasterxml.jackson.core.JsonFactory
_checkInvalidCopy, _copy, _createContentReference, _createContentReference, _createContext, _createContext, _createNonBlockingContext, _createParser, _decorate, _decorate, _decorate, _decorate, _decorate, _decorate, _getBufferRecycler, _getRecyclerPool, canHandleBinaryNatively, canParseAsync, canUseSchema, configure, configure, configure, createGenerator, createGenerator, createJsonGenerator, createJsonGenerator, createJsonGenerator, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createNonBlockingByteArrayParser, createNonBlockingByteBufferParser, createParser, disable, disable, disable, enable, enable, enable, getCharacterEscapes, getCodec, getFactoryFeatures, getGeneratorFeatures, getInputDecorator, getOutputDecorator, getParserFeatures, getRootValueSeparator, hasJSONFormat, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, requiresCustomCodec, requiresPropertyOrdering, setCharacterEscapes, setCodec, setErrorReportConfiguration, setInputDecorator, setOutputDecorator, setRecyclerPool, setRootValueSeparator, setStreamReadConstraints, setStreamWriteConstraints, streamReadConstraints, streamWriteConstraints
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
FORMAT_NAME_YAML
public static final java.lang.String FORMAT_NAME_YAML
Name used to identify YAML format. (and returned bygetFormatName()
- See Also:
- Constant Field Values
-
DEFAULT_YAML_PARSER_FEATURE_FLAGS
protected static final int DEFAULT_YAML_PARSER_FEATURE_FLAGS
Bitfield (set of flags) of all parser features that are enabled by default.
-
DEFAULT_YAML_GENERATOR_FEATURE_FLAGS
protected static final int DEFAULT_YAML_GENERATOR_FEATURE_FLAGS
Bitfield (set of flags) of all generator features that are enabled by default.
-
UTF8_BOM_1
private static final byte UTF8_BOM_1
- See Also:
- Constant Field Values
-
UTF8_BOM_2
private static final byte UTF8_BOM_2
- See Also:
- Constant Field Values
-
UTF8_BOM_3
private static final byte UTF8_BOM_3
- See Also:
- Constant Field Values
-
_yamlGeneratorFeatures
protected int _yamlGeneratorFeatures
-
_yamlParserFeatures
protected int _yamlParserFeatures
-
_version
protected final org.yaml.snakeyaml.DumperOptions.Version _version
YAML version for underlying generator to follow, if specified.- Since:
- 2.12
-
_quotingChecker
protected final StringQuotingChecker _quotingChecker
Helper object used to determine whether property names, String values must be quoted or not.- Since:
- 2.12
-
_loaderOptions
protected final org.yaml.snakeyaml.LoaderOptions _loaderOptions
Configuration for underlying parser to follow, if specified; left asnull
for backwards compatibility (which means whatever default settingsSnakeYAML
deems best).If you need to support parsing YAML files that are larger than 3Mb, it is recommended that you provide a LoaderOptions instance where you set the Codepoint Limit to a larger value than its 3Mb default.
- Since:
- 2.14
-
_dumperOptions
protected final org.yaml.snakeyaml.DumperOptions _dumperOptions
Configuration for underlying generator to follow, if specified; left asnull
for backwards compatibility (which means the dumper options are derived based onYAMLGenerator.Feature
s).These
YAMLGenerator.Feature
s are ignored if you provide your own DumperOptions:YAMLGenerator.Feature.ALLOW_LONG_KEYS
YAMLGenerator.Feature.CANONICAL_OUTPUT
YAMLGenerator.Feature.INDENT_ARRAYS
YAMLGenerator.Feature.INDENT_ARRAYS_WITH_INDICATOR
YAMLGenerator.Feature.SPLIT_LINES
YAMLGenerator.Feature.USE_PLATFORM_LINE_BREAKS
- Since:
- 2.14
-
-
Constructor Detail
-
YAMLFactory
public YAMLFactory()
Default constructor used to create factory instances. Creation of a factory instance is a light-weight operation, but it is still a good idea to reuse limited number of factory instances (and quite often just a single instance): factories are used as context for storing some reused processing objects (such as symbol tables parsers use) and this reuse only works within context of a single factory instance.
-
YAMLFactory
public YAMLFactory(com.fasterxml.jackson.core.ObjectCodec oc)
-
YAMLFactory
public YAMLFactory(YAMLFactory src, com.fasterxml.jackson.core.ObjectCodec oc)
- Since:
- 2.2
-
YAMLFactory
protected YAMLFactory(YAMLFactoryBuilder b)
Constructors used byYAMLFactoryBuilder
for instantiation.- Since:
- 3.0
-
-
Method Detail
-
rebuild
public YAMLFactoryBuilder rebuild()
- Overrides:
rebuild
in classcom.fasterxml.jackson.core.JsonFactory
-
builder
public static YAMLFactoryBuilder builder()
Main factory method to use for constructingYAMLFactory
instances with different configuration.
-
copy
public YAMLFactory copy()
- Overrides:
copy
in classcom.fasterxml.jackson.core.JsonFactory
-
readResolve
protected java.lang.Object readResolve()
Method that we need to override to actually make restoration go through constructors etc. Also: must be overridden by sub-classes as well.- Overrides:
readResolve
in classcom.fasterxml.jackson.core.JsonFactory
-
version
public com.fasterxml.jackson.core.Version version()
- Specified by:
version
in interfacecom.fasterxml.jackson.core.Versioned
- Overrides:
version
in classcom.fasterxml.jackson.core.JsonFactory
-
canUseCharArrays
public boolean canUseCharArrays()
- Overrides:
canUseCharArrays
in classcom.fasterxml.jackson.core.JsonFactory
-
getFormatReadFeatureType
public java.lang.Class<YAMLParser.Feature> getFormatReadFeatureType()
- Overrides:
getFormatReadFeatureType
in classcom.fasterxml.jackson.core.JsonFactory
-
getFormatWriteFeatureType
public java.lang.Class<YAMLGenerator.Feature> getFormatWriteFeatureType()
- Overrides:
getFormatWriteFeatureType
in classcom.fasterxml.jackson.core.JsonFactory
-
getFormatName
public java.lang.String getFormatName()
- Overrides:
getFormatName
in classcom.fasterxml.jackson.core.JsonFactory
-
hasFormat
public com.fasterxml.jackson.core.format.MatchStrength hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc) throws java.io.IOException
Sub-classes need to override this method- Overrides:
hasFormat
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
configure
public final YAMLFactory configure(YAMLGenerator.Feature f, boolean state)
Method for enabling or disabling specified generator feature (checkYAMLGenerator.Feature
for list of features)
-
enable
public YAMLFactory enable(YAMLGenerator.Feature f)
Method for enabling specified generator features (checkYAMLGenerator.Feature
for list of features)
-
disable
public YAMLFactory disable(YAMLGenerator.Feature f)
Method for disabling specified generator feature (checkYAMLGenerator.Feature
for list of features)
-
isEnabled
public final boolean isEnabled(YAMLGenerator.Feature f)
Check whether specified generator feature is enabled.
-
getFormatGeneratorFeatures
public int getFormatGeneratorFeatures()
- Overrides:
getFormatGeneratorFeatures
in classcom.fasterxml.jackson.core.JsonFactory
-
configure
public final YAMLFactory configure(YAMLParser.Feature f, boolean state)
Method for enabling or disabling specified parser feature (checkYAMLParser.Feature
for list of features)
-
enable
public YAMLFactory enable(YAMLParser.Feature f)
Method for enabling specified parser feature (checkYAMLParser.Feature
for list of features)
-
disable
public YAMLFactory disable(YAMLParser.Feature f)
Method for disabling specified parser features (checkYAMLParser.Feature
for list of features)
-
isEnabled
public final boolean isEnabled(YAMLParser.Feature f)
Checked whether specified parser feature is enabled.
-
getFormatParserFeatures
public int getFormatParserFeatures()
- Overrides:
getFormatParserFeatures
in classcom.fasterxml.jackson.core.JsonFactory
-
createParser
public YAMLParser createParser(java.lang.String content) throws java.io.IOException
- Overrides:
createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createParser
public YAMLParser createParser(java.io.File f) throws java.io.IOException
- Overrides:
createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createParser
public YAMLParser createParser(java.net.URL url) throws java.io.IOException
- Overrides:
createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createParser
public YAMLParser createParser(java.io.InputStream in) throws java.io.IOException
- Overrides:
createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createParser
public YAMLParser createParser(java.io.Reader r) throws java.io.IOException
- Overrides:
createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createParser
public YAMLParser createParser(char[] data) throws java.io.IOException
- Overrides:
createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createParser
public YAMLParser createParser(char[] data, int offset, int len) throws java.io.IOException
- Overrides:
createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createParser
public YAMLParser createParser(byte[] data) throws java.io.IOException
- Overrides:
createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createParser
public YAMLParser createParser(byte[] data, int offset, int len) throws java.io.IOException
- Overrides:
createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createGenerator
public YAMLGenerator createGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) throws java.io.IOException
- Overrides:
createGenerator
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createGenerator
public YAMLGenerator createGenerator(java.io.OutputStream out) throws java.io.IOException
- Overrides:
createGenerator
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createGenerator
public YAMLGenerator createGenerator(java.io.Writer out) throws java.io.IOException
- Overrides:
createGenerator
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
createGenerator
public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.File f, com.fasterxml.jackson.core.JsonEncoding enc) throws java.io.IOException
- Overrides:
createGenerator
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
_createParser
protected YAMLParser _createParser(java.io.InputStream in, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
- Overrides:
_createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
_createParser
protected YAMLParser _createParser(java.io.Reader r, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
- Overrides:
_createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
_createParser
protected YAMLParser _createParser(char[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt, boolean recyclable) throws java.io.IOException
- Overrides:
_createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
_createParser
protected YAMLParser _createParser(byte[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
- Overrides:
_createParser
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
_createGenerator
protected YAMLGenerator _createGenerator(java.io.Writer out, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
- Overrides:
_createGenerator
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
_createUTF8Generator
protected YAMLGenerator _createUTF8Generator(java.io.OutputStream out, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
- Overrides:
_createUTF8Generator
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
_createWriter
protected java.io.Writer _createWriter(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
- Overrides:
_createWriter
in classcom.fasterxml.jackson.core.JsonFactory
- Throws:
java.io.IOException
-
_createReader
protected java.io.Reader _createReader(java.io.InputStream in, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
- Throws:
java.io.IOException
-
_createReader
protected java.io.Reader _createReader(byte[] data, int offset, int len, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
- Throws:
java.io.IOException
-
-