Skip navigation links

Package io.vertx.core.file

== Using the file system with Vert.x The Vert.x FileSystem object provides many operations for manipulating the file system.

See: Description

Package io.vertx.core.file Description

== Using the file system with Vert.x The Vert.x FileSystem object provides many operations for manipulating the file system. There is one file system object per Vert.x instance, and you obtain it with Vertx.fileSystem(). A blocking and a non blocking version of each operation is provided. The non blocking versions take a handler which is called when the operation completes or an error occurs. Here's an example of asynchronously copying a file: [source,$lang] ---- FileSystemExamples.example1(io.vertx.core.Vertx) ---- The blocking versions are named xxxBlocking and return the results or throw exceptions directly. In many cases, depending on the operating system and file system,some of the potentially blocking operations can return quickly, which is why we provide them, but it's highly recommended that you test how long they take to return in your particular application before using them from an event loop, so as not to break the Golden Rule. Here's the copy using the blocking API: [source,$lang] ---- FileSystemExamples.example2(io.vertx.core.Vertx) ---- Many operations exist to copy, move, truncate, chmod and many other file operations. We won't list them all here, please consult the API docs for the full list. === Asynchronous files Vert.x provides an asynchronous file abstraction that allows you to manipulate a file on the file system You open an AsyncFile as follows: [source,$lang] ---- FileSystemExamples.example3(io.vertx.core.file.FileSystem) ---- TODO
Skip navigation links

Copyright © 2015. All Rights Reserved.