Example usage for io.vertx.core.file OpenOptions setCreate

List of usage examples for io.vertx.core.file OpenOptions setCreate

Introduction

In this page you can find the example usage for io.vertx.core.file OpenOptions setCreate.

Prototype

public OpenOptions setCreate(boolean create) 

Source Link

Document

Set whether the file should be created if it does not already exist.

Usage

From source file:de.notizwerk.Consumer.java

License:Open Source License

private void setUpFileSystem(Handler<Void> onCompletion) {
    OpenOptions options = new OpenOptions();
    options.setCreate(true).setTruncateExisting(true).setDsync(false);

    String fileName = name + ".txt";
    vertx.fileSystem().open(fileName, options, res -> {
        if (res.succeeded()) {
            file = res.result();//from  w  w w . j a v  a 2s .  com
            onCompletion.handle(null);
        } else {
            System.out.println("unable to setup file:" + fileName);
        }
    });
}