Class Emitter
java.lang.Object
org.snakeyaml.engine.v2.emitter.Emitter
- All Implemented Interfaces:
Emitable
Emitter expects events obeying the following grammar: stream ::= STREAM-START document* STREAM-END document ::= DOCUMENT-START node DOCUMENT-END node ::= SCALAR | sequence | mapping sequence ::= SEQUENCE-START node* SEQUENCE-END mapping ::= MAPPING-START (node node)* MAPPING-END
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate ScalarAnalysisprivate intprivate final Stringprivate intprivate final CommentEventsCollectorprivate final Booleanprivate intprivate final booleanprivate Eventprivate intprivate static final Patternprivate Integerprivate booleanprivate final ArrayStack<Integer> private final booleanprivate final intprivate final CommentEventsCollectorprivate booleanstatic final intindent should not be more than 10 spacesprivate final intstatic final intindent cannot be zero spacesprivate final Booleanprivate booleanprivate Stringprivate booleanprivate Optional<ScalarStyle> private booleanprivate static final Stringprivate final booleanprivate EmitterStateprivate final ArrayStack<EmitterState> private final StreamDataWriterprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ScalarAnalysisanalyzeScalar(String scalar) private booleanprivate booleanprivate booleanprivate Optional<ScalarStyle> private StringdetermineBlockHints(String text) voidSerialise event to bytesprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidexpectNode(boolean root, boolean mapping, boolean simpleKey) private void(package private) voidprivate voidprivate voidincreaseIndent(boolean isFlow, boolean indentless) private booleanisFoldedOrLiteral(Event event) private booleanneedEvents(Iterator<Event> iter, int count) private booleanprivate StringprepareTag(String tag) private StringprepareTagHandle(String handle) private StringprepareTagPrefix(String prefix) private StringprepareVersion(SpecVersion version) private voidprocessAnchor(String indicator) private voidprivate voidprivate voidprivate booleanwriteCommentLines(List<CommentLine> commentLines) private voidwriteDoubleQuoted(String text, boolean split) (package private) voidwriteFolded(String text, boolean split) (package private) void(package private) voidwriteIndicator(String indicator, boolean needWhitespace, boolean whitespace, boolean indentation) private booleanprivate voidwriteLineBreak(String data) (package private) voidwriteLiteral(String text) (package private) voidwritePlain(String text, boolean split) private voidwriteSingleQuoted(String text, boolean split) (package private) void(package private) void(package private) voidwriteTagDirective(String handleText, String prefixText) (package private) voidwriteVersionDirective(String versionText) private voidwriteWhitespace(int length)
-
Field Details
-
ESCAPE_REPLACEMENTS
-
MIN_INDENT
public static final int MIN_INDENTindent cannot be zero spaces- See Also:
-
MAX_INDENT
public static final int MAX_INDENTindent should not be more than 10 spaces- See Also:
-
SPACE
- See Also:
-
DEFAULT_TAG_PREFIXES
-
stream
-
states
-
state
-
events
-
event
-
indents
-
indent
-
flowLevel
private int flowLevel -
rootContext
private boolean rootContext -
mappingContext
private boolean mappingContext -
simpleKeyContext
private boolean simpleKeyContext -
column
private int column -
whitespace
private boolean whitespace -
indention
private boolean indention -
openEnded
private boolean openEnded -
canonical
-
multiLineFlow
-
allowUnicode
private final boolean allowUnicode -
bestIndent
private int bestIndent -
indicatorIndent
private final int indicatorIndent -
indentWithIndicator
private final boolean indentWithIndicator -
bestWidth
private int bestWidth -
bestLineBreak
-
splitLines
private final boolean splitLines -
maxSimpleKeyLength
private final int maxSimpleKeyLength -
emitComments
private final boolean emitComments -
tagPrefixes
-
preparedAnchor
-
preparedTag
-
analysis
-
scalarStyle
-
blockCommentsCollector
-
inlineCommentsCollector
-
HANDLE_FORMAT
-
-
Constructor Details
-
Emitter
Create- Parameters:
opts- - configuration optionsstream- - output stream
-
-
Method Details
-
emit
-
needMoreEvents
private boolean needMoreEvents() -
needEvents
-
increaseIndent
private void increaseIndent(boolean isFlow, boolean indentless) -
expectNode
private void expectNode(boolean root, boolean mapping, boolean simpleKey) -
handleNodeEvent
-
expectAlias
private void expectAlias() -
expectScalar
private void expectScalar() -
expectFlowSequence
private void expectFlowSequence() -
expectFlowMapping
private void expectFlowMapping() -
expectBlockSequence
private void expectBlockSequence() -
expectBlockMapping
private void expectBlockMapping() -
isFoldedOrLiteral
-
checkEmptySequence
private boolean checkEmptySequence() -
checkEmptyMapping
private boolean checkEmptyMapping() -
checkSimpleKey
private boolean checkSimpleKey() -
processAnchor
-
processTag
private void processTag() -
chooseScalarStyle
-
processScalar
private void processScalar() -
prepareVersion
-
prepareTagHandle
-
prepareTagPrefix
-
prepareTag
-
analyzeScalar
-
flushStream
void flushStream() -
writeStreamStart
void writeStreamStart() -
writeStreamEnd
void writeStreamEnd() -
writeIndicator
void writeIndicator(String indicator, boolean needWhitespace, boolean whitespace, boolean indentation) -
writeIndent
void writeIndent() -
writeWhitespace
private void writeWhitespace(int length) -
writeLineBreak
-
writeVersionDirective
-
writeTagDirective
-
writeSingleQuoted
-
writeDoubleQuoted
-
writeCommentLines
-
writeBlockComment
private void writeBlockComment() -
writeInlineComments
private boolean writeInlineComments() -
determineBlockHints
-
writeFolded
-
writeLiteral
-
writePlain
-