|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.fasterxml.jackson.core.JsonGenerator
com.fasterxml.jackson.core.base.GeneratorBase
com.fasterxml.jackson.core.json.JsonGeneratorImpl
public abstract class JsonGeneratorImpl
Intermediate base class shared by JSON-backed generators
like UTF8JsonGenerator and WriterBasedJsonGenerator.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.fasterxml.jackson.core.JsonGenerator |
|---|
JsonGenerator.Feature |
| Field Summary | |
|---|---|
protected boolean |
_cfgUnqNames
Flag that is set if quoting is not to be added around JSON Object property names. |
protected CharacterEscapes |
_characterEscapes
Definition of custom character escapes to use for generators created by this factory, if any. |
protected IOContext |
_ioContext
|
protected int |
_maximumNonEscapedChar
Value between 128 (0x80) and 65535 (0xFFFF) that indicates highest Unicode code point that will not need escaping; or 0 to indicate that all characters can be represented without escaping. |
protected int[] |
_outputEscapes
Currently active set of output escape code definitions (whether and how to escape or not) for 7-bit ASCII range (first 128 character codes). |
protected SerializableString |
_rootValueSeparator
Separator to use, if any, between root-level values. |
protected static int[] |
sOutputEscapes
This is the default set of escape codes, over 7-bit ASCII range (first 128 character codes), used for single-byte UTF-8 characters. |
| Fields inherited from class com.fasterxml.jackson.core.base.GeneratorBase |
|---|
_cfgNumbersAsStrings, _closed, _features, _objectCodec, _writeContext, DERIVED_FEATURES_MASK, SURR1_FIRST, SURR1_LAST, SURR2_FIRST, SURR2_LAST, WRITE_BINARY, WRITE_BOOLEAN, WRITE_NULL, WRITE_NUMBER, WRITE_RAW, WRITE_STRING |
| Fields inherited from class com.fasterxml.jackson.core.JsonGenerator |
|---|
_cfgPrettyPrinter |
| Constructor Summary | |
|---|---|
JsonGeneratorImpl(IOContext ctxt,
int features,
ObjectCodec codec)
|
|
| Method Summary | |
|---|---|
protected void |
_checkStdFeatureChanges(int newFeatureFlags,
int changedFeatures)
Helper method called to verify changes to standard features. |
JsonGenerator |
disable(JsonGenerator.Feature f)
Method for disabling specified features (check JsonGenerator.Feature for list of features) |
JsonGenerator |
enable(JsonGenerator.Feature f)
Method for enabling specified parser features: check JsonGenerator.Feature for list of available features. |
CharacterEscapes |
getCharacterEscapes()
Method for accessing custom escapes factory uses for JsonGenerators
it creates. |
int |
getHighestEscapedChar()
Accessor method for testing what is the highest unescaped character configured for this generator. |
JsonGenerator |
setCharacterEscapes(CharacterEscapes esc)
Method for defining custom escapes factory uses for JsonGenerators
it creates. |
JsonGenerator |
setHighestNonEscapedChar(int charCode)
Method that can be called to request that generator escapes all character codes above specified code point (if positive value); or, to not escape any characters except for ones that must be escaped for the data format (if -1). |
JsonGenerator |
setRootValueSeparator(SerializableString sep)
Method that allows overriding String used for separating root-level JSON values (default is single space character) |
Version |
version()
Implemented with standard version number detection algorithm, typically using a simple generated class, with information extracted from Maven project file during build. |
void |
writeStringField(String fieldName,
String value)
Convenience method for outputting a field entry ("member") that has a String value. |
| Methods inherited from class com.fasterxml.jackson.core.base.GeneratorBase |
|---|
_constructDefaultPrettyPrinter, _decodeSurrogate, _releaseBuffers, _verifyValueWrite, close, flush, getCodec, getCurrentValue, getFeatureMask, getOutputContext, isClosed, isEnabled, overrideStdFeatures, setCodec, setCurrentValue, setFeatureMask, useDefaultPrettyPrinter, writeBinary, writeFieldName, writeObject, writeRawValue, writeRawValue, writeRawValue, writeRawValue, writeString, writeTree |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int[] sOutputEscapes
protected final IOContext _ioContext
protected int[] _outputEscapes
protected int _maximumNonEscapedChar
NOTE: not all sub-classes make use of this setting.
protected CharacterEscapes _characterEscapes
protected SerializableString _rootValueSeparator
protected boolean _cfgUnqNames
| Constructor Detail |
|---|
public JsonGeneratorImpl(IOContext ctxt,
int features,
ObjectCodec codec)
| Method Detail |
|---|
public JsonGenerator enable(JsonGenerator.Feature f)
JsonGeneratorJsonGenerator.Feature for list of available features.
enable in class GeneratorBasepublic JsonGenerator disable(JsonGenerator.Feature f)
JsonGeneratorJsonGenerator.Feature for list of features)
disable in class GeneratorBase
protected void _checkStdFeatureChanges(int newFeatureFlags,
int changedFeatures)
GeneratorBase
_checkStdFeatureChanges in class GeneratorBasenewFeatureFlags - Bitflag of standard features after they were changedchangedFeatures - Bitflag of standard features for which setting
did changepublic JsonGenerator setHighestNonEscapedChar(int charCode)
JsonGeneratorNote that generators are NOT required to support setting of value higher than 127, because there are other ways to affect quoting (or lack thereof) of character codes between 0 and 127. Not all generators support concept of escaping, either; if so, calling this method will have no effect.
Default implementation does nothing; sub-classes need to redefine it according to rules of supported data format.
setHighestNonEscapedChar in class JsonGeneratorcharCode - Either -1 to indicate that no additional escaping
is to be done; or highest code point not to escape (meaning higher
ones will be), if positive value.public int getHighestEscapedChar()
JsonGenerator
getHighestEscapedChar in class JsonGeneratorpublic JsonGenerator setCharacterEscapes(CharacterEscapes esc)
JsonGeneratorJsonGenerators
it creates.
Default implementation does nothing and simply returns this instance.
setCharacterEscapes in class JsonGeneratorpublic CharacterEscapes getCharacterEscapes()
JsonGenerators
it creates.
getCharacterEscapes in class JsonGeneratorpublic JsonGenerator setRootValueSeparator(SerializableString sep)
JsonGenerator
Default implementation throws UnsupportedOperationException.
setRootValueSeparator in class JsonGeneratorsep - Separator to use, if any; null means that no separator is
automatically addedpublic Version version()
GeneratorBase
version in interface Versionedversion in class GeneratorBase
public final void writeStringField(String fieldName,
String value)
throws IOException
JsonGeneratorwriteFieldName(fieldName); writeString(value);
Note: many performance-sensitive implementations override this method
writeStringField in class JsonGeneratorIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||