Package org.vertx.java.core.file

Examples of org.vertx.java.core.file.FileSystemException


        try {
          byte[] bytes = Files.readAllBytes(target);
          Buffer buff = new Buffer(bytes);
          return buff;
        } catch (IOException e) {
          throw new FileSystemException(e);
        }
      }
    };
  }
View Full Code Here


      public Void action() {
        try {
          Files.write(target, data.getBytes());
          return null;
        } catch (IOException e) {
          throw new FileSystemException(e);
        }
      }
    };
  }
View Full Code Here

            Files.createFile(target, attrs);
          } else {
            Files.createFile(target);
          }
        } catch (IOException e) {
          throw new FileSystemException(e);
        }
        return null;
      }
    };
  }
View Full Code Here

      public FileSystemProps action() {
        try {
          FileStore fs = Files.getFileStore(target);
          return new DefaultFileSystemProps(fs.getTotalSpace(), fs.getUnallocatedSpace(), fs.getUsableSpace());
        } catch (IOException e) {
          throw new FileSystemException(e);
        }
      }
    };
  }
View Full Code Here

  private boolean readInProgress;

  DefaultAsyncFile(final VertxInternal vertx, final String path, String perms, final boolean read, final boolean write, final boolean createNew,
            final boolean flush, final DefaultContext context) {
    if (!read && !write) {
      throw new FileSystemException("Cannot open file for neither reading nor writing");
    }
    this.vertx = vertx;
    Path file = Paths.get(path);
    HashSet<OpenOption> options = new HashSet<>();
    if (read) options.add(StandardOpenOption.READ);
    if (write) options.add(StandardOpenOption.WRITE);
    if (createNew) options.add(StandardOpenOption.CREATE);
    if (flush) options.add(StandardOpenOption.DSYNC);
    try {
      if (perms != null) {
        FileAttribute<?> attrs = PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString(perms));
        ch = AsynchronousFileChannel.open(file, options, vertx.getBackgroundPool(), attrs);
      } else {
        ch = AsynchronousFileChannel.open(file, options, vertx.getBackgroundPool());
      }
    } catch (IOException e) {
      throw new FileSystemException(e);
    }
    this.context = context;
  }
View Full Code Here

      public Void action() {
        try {
          ch.force(false);
          return null;
        } catch (IOException e) {
          throw new FileSystemException(e);
        }
      }
    }.run();
  }
View Full Code Here

TOP

Related Classes of org.vertx.java.core.file.FileSystemException

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.