List of usage examples for io.vertx.core.file FileSystem writeFileBlocking
@Fluent FileSystem writeFileBlocking(String path, Buffer data);
From source file:de.braintags.netrelay.init.Settings.java
License:Open Source License
private static Settings loadSettings(NetRelay netRelay, Vertx vertx, String path) { FileSystem fs = vertx.fileSystem(); if (fs.existsBlocking(path)) { LOGGER.info("going to load settings from " + path); Buffer buffer = fs.readFileBlocking(path); Settings settings = Json.decodeValue(buffer.toString(), Settings.class); LOGGER.info("settings successfully loaded from " + path); return settings; } else {//from ww w . j av a 2s. c om LOGGER.info("creating default settings and store them in " + path); Settings settings = netRelay.createDefaultSettings(); fs.writeFileBlocking(path, Buffer.buffer(Json.encodePrettily(settings))); String message = String.format( "Settings file did not exist and was created new in path %s. NOTE: edit the file, set edited to true and restart the server", path); throw new InitException(message); } }