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 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 char[]private 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 static final Patternprivate booleanstatic final intindent should not be more than 10 spacesprivate final intstatic final intindent cannot be zero spacesprivate booleanprivate Stringprivate Stringprivate final Booleanprivate booleanprivate booleanprivate static final char[]private static final Patternprivate final booleanprivate EmitterStateprivate final ArrayStack<EmitterState> private final Writerprivate DumperOptions.ScalarStyleprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ScalarAnalysisanalyzeScalar(String scalar) private booleanprivate booleanprivate booleanprivate booleanprivate DumperOptions.ScalarStyleprivate StringdetermineBlockHints(String text) voidPush event to bytesprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidexpectNode(boolean root, boolean mapping, boolean simpleKey) private void(package private) voidprivate voidincreaseIndent(boolean flow, boolean indentless) private booleanisFoldedOrLiteral(Event event) private booleanneedEvents(Iterator<Event> iter, int count) private boolean(package private) static StringprepareAnchor(String anchor) private StringprepareTag(String tag) private StringprepareTagHandle(String handle) private StringprepareTagPrefix(String prefix) private StringprepareVersion(DumperOptions.Version 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
-
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:EmitablePush event to bytes- Specified by:
emitin 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
-