All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.redskap.swagger.brake.report.file.FileWriter Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package io.redskap.swagger.brake.report.file;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class FileWriter {
    public void write(String filePath, String content) {
        try {
            log.debug("File path {}", filePath);
            Path path = Paths.get(filePath);
            Files.write(path, Collections.singleton(content));
        } catch (IOException e) {
            throw new RuntimeException("Error happened while writing the output file", e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy