Package org.yaml.snakeyaml.emitter
Class Emitter
java.lang.Object
org.yaml.snakeyaml.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 char[]
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 static final Pattern
private boolean
static final int
indent should not be more than 10 spacesprivate final int
static final int
indent cannot be zero spacesprivate boolean
private String
private String
private final Boolean
private boolean
private boolean
private static final char[]
private static final Pattern
private final boolean
private EmitterState
private final ArrayStack
<EmitterState> private final Writer
private DumperOptions.ScalarStyle
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ScalarAnalysis
analyzeScalar
(String scalar) private boolean
private boolean
private boolean
private boolean
private DumperOptions.ScalarStyle
private String
determineBlockHints
(String text) void
Push 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
increaseIndent
(boolean flow, boolean indentless) private boolean
isFoldedOrLiteral
(Event event) private boolean
needEvents
(Iterator<Event> iter, int count) private boolean
(package private) static String
prepareAnchor
(String anchor) private String
prepareTag
(String tag) private String
prepareTagHandle
(String handle) private String
prepareTagPrefix
(String prefix) private String
prepareVersion
(DumperOptions.Version 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
-
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
private static final char[] SPACE -
SPACES_PATTERN
-
INVALID_ANCHOR
-
ESCAPE_REPLACEMENTS
-
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
-
prettyFlow
-
allowUnicode
private final boolean allowUnicode -
bestIndent
private int bestIndent -
indicatorIndent
private final int indicatorIndent -
indentWithIndicator
private final boolean indentWithIndicator -
bestWidth
private int bestWidth -
bestLineBreak
private final char[] bestLineBreak -
splitLines
private final boolean splitLines -
maxSimpleKeyLength
private final int maxSimpleKeyLength -
emitComments
private final boolean emitComments -
tagPrefixes
-
preparedAnchor
-
preparedTag
-
analysis
-
style
-
blockCommentsCollector
-
inlineCommentsCollector
-
HANDLE_FORMAT
-
LEADING_ZERO_PATTERN
-
-
Constructor Details
-
Emitter
Create- Parameters:
stream
- - output to write toopts
- - options
-
-
Method Details
-
emit
Description copied from interface:Emitable
Push event to bytes- Specified by:
emit
in interfaceEmitable
- Parameters:
event
- - the source- Throws:
IOException
- if bytes bite
-
needMoreEvents
private boolean needMoreEvents() -
needEvents
-
increaseIndent
private void increaseIndent(boolean flow, boolean indentless) -
expectNode
- Throws:
IOException
-
expectAlias
- Throws:
IOException
-
expectScalar
- Throws:
IOException
-
expectFlowSequence
- Throws:
IOException
-
expectFlowMapping
- Throws:
IOException
-
expectBlockSequence
- Throws:
IOException
-
expectBlockMapping
- Throws:
IOException
-
isFoldedOrLiteral
-
checkEmptySequence
private boolean checkEmptySequence() -
checkEmptyMapping
private boolean checkEmptyMapping() -
checkEmptyDocument
private boolean checkEmptyDocument() -
checkSimpleKey
private boolean checkSimpleKey() -
processAnchor
- Throws:
IOException
-
processTag
- Throws:
IOException
-
chooseScalarStyle
-
processScalar
- Throws:
IOException
-
prepareVersion
-
prepareTagHandle
-
prepareTagPrefix
-
prepareTag
-
prepareAnchor
-
analyzeScalar
-
flushStream
- Throws:
IOException
-
writeStreamStart
void writeStreamStart() -
writeStreamEnd
- Throws:
IOException
-
writeIndicator
void writeIndicator(String indicator, boolean needWhitespace, boolean whitespace, boolean indentation) throws IOException - Throws:
IOException
-
writeIndent
- Throws:
IOException
-
writeWhitespace
- Throws:
IOException
-
writeLineBreak
- Throws:
IOException
-
writeVersionDirective
- Throws:
IOException
-
writeTagDirective
- Throws:
IOException
-
writeSingleQuoted
- Throws:
IOException
-
writeDoubleQuoted
- Throws:
IOException
-
writeCommentLines
- Throws:
IOException
-
writeBlockComment
- Throws:
IOException
-
writeInlineComments
- Throws:
IOException
-
determineBlockHints
-
writeFolded
- Throws:
IOException
-
writeLiteral
- Throws:
IOException
-
writePlain
- Throws:
IOException
-