Package com.esotericsoftware.yamlbeans

Examples of com.esotericsoftware.yamlbeans.YamlWriter


      YamlConfig config = new YamlConfig();
      config.writeConfig.setAlwaysWriteClassname(false);
      config.writeConfig.setWriteRootElementTags(false);
      config.writeConfig.setWriteRootTags(false);
      config.writeConfig.setExplicitFirstDocument(true);
      YamlWriter yamlWriter = new YamlWriter(fileWriter, config);

      yamlWriter.write(targetInfos);

      yamlWriter.close();
      fileWriter.close();
    } catch (IOException e) {
      throw new RuntimeException("An error occurred writing the tokens file at " +
          tokensFile.getPath() + ":" + e.getMessage(), e);
    }
View Full Code Here


  public String getRenderedConfig() {
    List<String> lines;
   
    try {
      try(ByteArrayOutputStream byteStream = new ByteArrayOutputStream()) {
        YamlWriter writer = new YamlWriter(new PrintWriter(byteStream));
        writer.write(this);
        writer.close();
       
        // YamlWriter writes out the classname at the top of the file which we dont want
        lines = IOUtils.readLines(new ByteArrayInputStream(byteStream.toByteArray()));
        lines.remove(0);
      }
View Full Code Here

  }

  public String serialize(Object bean) {
    StringWriter writer = new StringWriter();
    try {
      YamlWriter yamlWriter = new YamlWriter(writer);
      try {
        yamlWriter.write(bean);
      } catch (YamlException e1) {
      } finally {
        try {
          yamlWriter.close();
        } catch (YamlException e) {
        }
      }
      writer.flush();
    } finally {
View Full Code Here

        RecentFiles readed=yamlReader.read(RecentFiles.class);
        readed=readed;
    }

    private static void writeYaml() throws IOException {
        YamlWriter writer = new YamlWriter(new FileWriter("C:\\Users\\usta\\Dropbox\\AsciidocFX\\conf\\recentFiles.yml"));
        writer.getConfig().setClassTag("Recent Files", RecentFiles.class);


        RecentFiles recentFiles=new RecentFiles();

        recentFiles.getFiles().add("01-chap.asc");
        recentFiles.getFiles().add("02-chap.asc");
        recentFiles.getFiles().add("03-chap.asc");
        recentFiles.getFiles().add("05-chap.asc");

        writer.write(recentFiles);
        writer.close();
    }
View Full Code Here

    public void setFontFamily(String fontFamily) {
        this.fontFamily = fontFamily;
    }

    public static void main(String[] args) throws IOException {
        YamlWriter writer = new YamlWriter(new FileWriter("C:\\Users\\usta\\Dropbox\\AsciidocFX\\conf\\config.yml"));
        writer.getConfig().setClassTag("Config", Config.class);
        Config config = new Config();
        config.setTheme("ace/theme/ace");
        config.setFontSize("14px");
        config.setDirectoryPanel(true);
        config.setRecentFileListSize(10);
        config.setScrollSpeed("0.1");
        config.setFontFamily("monospace");
        config.setWorkingDirectory(null);
        writer.write(config);
        writer.close();
    }
View Full Code Here

                .stream()
                .map(path -> path.toString())
                .collect(Collectors.toList());

        File recentFileYml = configPath.resolve("recentFiles.yml").toFile();
        YamlWriter yamlWriter = new YamlWriter(new FileWriter(recentFileYml));
        yamlWriter.getConfig().setClassTag("RecentFiles", RecentFiles.class);
        yamlWriter.write(new RecentFiles(fileList));
        yamlWriter.close();

        //

        File configYml = configPath.resolve("config.yml").toFile();
        yamlWriter = new YamlWriter(new FileWriter(configYml));
        yamlWriter.getConfig().setClassTag("Config", Config.class);
        yamlWriter.write(config);
        yamlWriter.close();

        Platform.exit();
        System.exit(0);

    }
View Full Code Here

  }

  public String serialize(Object bean) {
    StringWriter writer = new StringWriter();
    try {
      YamlWriter yamlWriter = new YamlWriter(writer);
      try {
        yamlWriter.write(bean);
      } catch (YamlException e1) {
      } finally {
        try {
          yamlWriter.close();
        } catch (YamlException e) {
        }
      }
      writer.flush();
    } finally {
View Full Code Here

TOP

Related Classes of com.esotericsoftware.yamlbeans.YamlWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.