List of usage examples for java.nio.file.attribute PosixFilePermissions fromString
public static Set<PosixFilePermission> fromString(String perms)
From source file:de.jwi.jfm.Folder.java
private void chmod(File file, String value) throws IOException { Path p = file.toPath();/*from w w w . j a v a 2s .c o m*/ FileSystem fileSystem = FileSystems.getDefault(); Set<String> fileSystemViews = fileSystem.supportedFileAttributeViews(); if (fileSystemViews.contains("posix")) { Set<PosixFilePermission> posixFilePermissions = PosixFilePermissions.fromString(value); if (posixFilePermissions == null) { throw new IllegalArgumentException(value); } Files.getFileAttributeView(p, PosixFileAttributeView.class).setPermissions(posixFilePermissions); } else if (fileSystemViews.contains("dos")) { } }
From source file:de.decoit.visa.rdf.RDFManager.java
/** * Write the RDF model to a RDF/XML file. The output file will be created at * the specified location.//from w ww . j ava 2 s . c o m * * @param pFile File object with path and file name of the output file * @throws IOException */ public void writeRDF(Path pFile) throws IOException { OutputStream os = Files.newOutputStream(pFile, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING); writeRDF(os); Set<PosixFilePermission> attrSet = PosixFilePermissions.fromString("rwxrwxrwx"); Files.setPosixFilePermissions(pFile, attrSet); }