Package com.amihaiemil.eoyaml
Class Yaml
- java.lang.Object
-
- com.amihaiemil.eoyaml.Yaml
-
public final class Yaml extends Object
Yaml.- Since:
- 1.0.0
- Version:
- $Id: 05fe6d17c950270bc5ca401185a9d818c4977f77 $
- Author:
- Mihai Andronache (amihaiemil@gmail.com)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static YamlDumpcreateYamlDump(Object object)Create a YAML dump to represent the given object as YAML.static YamlInputcreateYamlInput(File input)Create aYamlInputfrom a File.static YamlInputcreateYamlInput(File input, boolean guessIndentation)Create aYamlInputfrom a File.static YamlInputcreateYamlInput(InputStream input)Create aYamlInputfrom an InputStream.static YamlInputcreateYamlInput(InputStream input, boolean guessIndentation)Create aYamlInputfrom an InputStream.static YamlInputcreateYamlInput(String input)Create aYamlInputfrom a String.static YamlInputcreateYamlInput(String input, boolean guessIndentation)Create aYamlInputfrom a String.static YamlMappingBuildercreateYamlMappingBuilder()Create aYamlMappingBuilder.static YamlPrintercreateYamlPrinter(Writer destination)Create a YamlPrinter to write a YamlNode somewhere.static YamlScalarBuildercreateYamlScalarBuilder()Create aYamlScalarBuilder.static YamlSequenceBuildercreateYamlSequenceBuilder()Create aYamlSequenceBuilder.static YamlStreamBuildercreateYamlStreamBuilder()Create aYamlStreamBuilder.static YamlSequencefromJsonArray(javax.json.JsonArray array)Create a YAML sequence from aJsonArray.static YamlMappingfromJsonObject(javax.json.JsonObject object)Create a YAML mapping from aJsonObject.
-
-
-
Method Detail
-
createYamlMappingBuilder
public static YamlMappingBuilder createYamlMappingBuilder()
Create aYamlMappingBuilder.- Returns:
- Builder of YamlMapping.
-
createYamlSequenceBuilder
public static YamlSequenceBuilder createYamlSequenceBuilder()
Create aYamlSequenceBuilder.- Returns:
- Builder of YamlMapping.
-
createYamlScalarBuilder
public static YamlScalarBuilder createYamlScalarBuilder()
Create aYamlScalarBuilder.- Returns:
- Builder of Yaml Scalars.
-
createYamlStreamBuilder
public static YamlStreamBuilder createYamlStreamBuilder()
Create aYamlStreamBuilder.- Returns:
- Builder of YamlStream.
-
createYamlInput
public static YamlInput createYamlInput(File input) throws FileNotFoundException
Create aYamlInputfrom a File.- Parameters:
input- File to read from.- Returns:
- YamlInput, reader of Yaml.
- Throws:
FileNotFoundException- If the file is not found.
-
createYamlInput
public static YamlInput createYamlInput(File input, boolean guessIndentation) throws FileNotFoundException
Create aYamlInputfrom a File.- Parameters:
input- File to read from.guessIndentation- If set to true, we will try to guess the correct indentation of misplaced lines. The default value is false and an exception is thrown if indentation is not correct.- Returns:
- YamlInput, reader of Yaml.
- Throws:
FileNotFoundException- If the file is not found.
-
createYamlInput
public static YamlInput createYamlInput(String input)
Create aYamlInputfrom a String.- Parameters:
input- String to read from.- Returns:
- YamlInput, reader of Yaml.
-
createYamlInput
public static YamlInput createYamlInput(String input, boolean guessIndentation)
Create aYamlInputfrom a String.- Parameters:
input- String to read from.guessIndentation- If set to true, we will try to guess the correct indentation of misplaced lines. The default value is false and an exception is thrown if indentation is not correct.- Returns:
- YamlInput, reader of Yaml.
-
createYamlInput
public static YamlInput createYamlInput(InputStream input)
Create aYamlInputfrom an InputStream.- Parameters:
input- InputStream to read from.- Returns:
- YamlInput, reader of Yaml.
-
createYamlInput
public static YamlInput createYamlInput(InputStream input, boolean guessIndentation)
Create aYamlInputfrom an InputStream.- Parameters:
input- InputStream to read from.guessIndentation- If set to true, we will try to guess the correct indentation of misplaced lines. The default value is false and an exception is thrown if indentation is not correct.- Returns:
- YamlInput, reader of Yaml.
-
createYamlPrinter
public static YamlPrinter createYamlPrinter(Writer destination)
Create a YamlPrinter to write a YamlNode somewhere. If you want to print a YamlNode to String, just use YamlNode.toString() -- it is a convenience equivalent to:final YamlNode yaml = ...; final StringWriter stgWriter = new StringWriter(); Yaml.createYamlPrinter(stgWriter).print(yaml); System.out.println(stgWriter.toString());
- Parameters:
destination- Writer where the YamlNode will be printed.- Returns:
- YamlPrinter.
-
createYamlDump
public static YamlDump createYamlDump(Object object)
Create a YAML dump to represent the given object as YAML.- Parameters:
object- Object to dump.- Returns:
- YamlDump.
-
fromJsonObject
public static YamlMapping fromJsonObject(javax.json.JsonObject object)
Create a YAML mapping from aJsonObject.- Parameters:
object- JsonObject in question.- Returns:
- YamlMapping.
-
fromJsonArray
public static YamlSequence fromJsonArray(javax.json.JsonArray array)
Create a YAML sequence from aJsonArray.- Parameters:
array- JsonArray in question.- Returns:
- YamlSequence.
-
-