List of usage examples for org.apache.commons.vfs2 FileSystem hasCapability
boolean hasCapability(Capability capability);
From source file:org.fuin.vfs2.filter.CanWriteFileFilter.java
/** * Checks to see if the file can be written to. * // ww w . j a v a 2 s. co m * @param fileInfo * the File to check * * @return {@code true} if the file can be written to, otherwise * {@code false}. */ @Override public boolean accept(final FileSelectInfo fileInfo) { try { final FileSystem fileSystem = fileInfo.getFile().getFileSystem(); if (fileInfo.getFile().exists()) { if (!fileSystem.hasCapability(Capability.WRITE_CONTENT)) { return false; } return fileInfo.getFile().isWriteable(); } else { if (!fileSystem.hasCapability(Capability.CREATE)) { return false; } return fileInfo.getFile().getParent().isWriteable(); } } catch (final FileSystemException ex) { throw new RuntimeException(ex); } }