Package org.snakeyaml.engine.v2.emitter
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 class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
private ScalarAnalysis
private int
private final String
private int
private final CommentEventsCollector
private final Boolean
private int
private final boolean
private Event
private int
private static final Pattern
private Integer
private boolean
private final ArrayStack
<Integer> private final boolean
private final int
private final CommentEventsCollector
private boolean
static final int
indent should not be more than 10 spacesprivate final int
static final int
indent cannot be zero spacesprivate final Boolean
private boolean
private String
private boolean
private Optional
<ScalarStyle> private boolean
private static final String
private final boolean
private EmitterState
private final ArrayStack
<EmitterState> private final StreamDataWriter
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ScalarAnalysis
analyzeScalar
(String scalar) private boolean
private boolean
private boolean
private Optional
<ScalarStyle> private String
determineBlockHints
(String text) void
Serialise event to bytesprivate void
private void
private void
private void
private void
private void
expectNode
(boolean root, boolean mapping, boolean simpleKey) private void
(package private) void
private void
private void
increaseIndent
(boolean isFlow, boolean indentless) private boolean
isFoldedOrLiteral
(Event event) private boolean
needEvents
(Iterator<Event> iter, int count) private boolean
private String
prepareTag
(String tag) private String
prepareTagHandle
(String handle) private String
prepareTagPrefix
(String prefix) private String
prepareVersion
(SpecVersion version) private void
processAnchor
(String indicator) private void
private void
private void
private boolean
writeCommentLines
(List<CommentLine> commentLines) private void
writeDoubleQuoted
(String text, boolean split) (package private) void
writeFolded
(String text, boolean split) (package private) void
(package private) void
writeIndicator
(String indicator, boolean needWhitespace, boolean whitespace, boolean indentation) private boolean
private void
writeLineBreak
(String data) (package private) void
writeLiteral
(String text) (package private) void
writePlain
(String text, boolean split) private void
writeSingleQuoted
(String text, boolean split) (package private) void
(package private) void
(package private) void
writeTagDirective
(String handleText, String prefixText) (package private) void
writeVersionDirective
(String versionText) private void
writeWhitespace
(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
Description copied from interface:Emitable
Serialise event to bytes -
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
-