Skip to content

YAML-EDITOR-FOR-JAVA is a very easy package to Create , Read and Write Yaml file.

Notifications You must be signed in to change notification settings

sagarbhusal01/YAML-Editor-For-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YAML-Editor-For-Java

This package can be used to read and write into yaml file.


There are two main ways you can write data in the yaml file.


  • The Normal way :
#yaml file comment
        
{Key1 = value1, key2 = value2, key3 = value3}
// or
{Key1 = "value1", key2 = "value2", key3 = "value3"}
  • or the dynamic way
#yaml file comment
key1 : value1
key2 : value2
key3 : value3


How to use it?

  • First you have to download the jar file from this repo and place it in the project file.
  • After that you have to add that jar file as a dependencies into your project.
  • Then create an object for the YAML
  YAML yaml=new YAML();
  • Then set the mode of the Yaml read and Write operation
//either 

yaml.setMode("normal");

//or 
yaml.setMode("dynamic");

//Dynamic mode will set as default mode if setMode is not called 
  • Set the path of the yaml file
String Path="YAML.yaml";
  • To write into the file, create a HashMap
        HashMap<String,String> MappedData = new HashMap<>();
        MappedData.put("Name","Sagar bhusal");
        MappedData.put("Type1","Awesome1");
        MappedData.put("Type2","Awesome2");
        MappedData.put("Type3","Awesome3");
        MappedData.put("Type4","Awesome4");
        boolean appendOrNot = false;

-Then pass the data and path into the Writer method

yaml.Writer(MappedData,Path,appendOrNot);
  • For reading the data from the file create a empty hashmap
  HashMap<String,String> ReadData = new HashMap<>();
  • Then call
ReadData = yaml.Reader(Path);

About

YAML-EDITOR-FOR-JAVA is a very easy package to Create , Read and Write Yaml file.

Topics

Resources

Stars

Watchers

Forks

Languages