use of java.nio.file.attribute.FileAttribute in project j2objc by google.
the class FilesTest method test_createDirectories$Path$Attr_NPE.
@Test
public void test_createDirectories$Path$Attr_NPE() throws IOException {
Path dirPath = filesSetup.getPathInTestDir("dir1/dir2/dir3");
Set<PosixFilePermission> perm = PosixFilePermissions.fromString("rwx------");
FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perm);
try {
Files.createDirectories(null, attr);
fail();
} catch (NullPointerException expected) {
}
try {
Files.createDirectories(dirPath, (FileAttribute<?>[]) null);
fail();
} catch (NullPointerException expected) {
}
}
use of java.nio.file.attribute.FileAttribute in project tomcat by apache.
the class TestFileResourceSet method before.
@BeforeClass
public static void before() throws IOException {
tempDir = Files.createTempDirectory("test", new FileAttribute[0]);
dir2 = new File(tempDir.toFile(), "dir2");
TomcatBaseTest.recursiveCopy(new File("test/webresources/dir2").toPath(), dir2.toPath());
}
use of java.nio.file.attribute.FileAttribute in project tomcat by apache.
the class TestDirResourceSetInternal method before.
@BeforeClass
public static void before() throws IOException {
tempDir = Files.createTempDirectory("test", new FileAttribute[0]);
dir1 = new File(tempDir.toFile(), "dir1");
TomcatBaseTest.recursiveCopy(new File("test/webresources/dir1").toPath(), dir1.toPath());
}
use of java.nio.file.attribute.FileAttribute in project tomcat by apache.
the class TestFileResourceSetReadOnly method before.
@BeforeClass
public static void before() throws IOException {
tempDir = Files.createTempDirectory("test", new FileAttribute[0]);
dir2 = new File(tempDir.toFile(), "dir2");
TomcatBaseTest.recursiveCopy(new File("test/webresources/dir2").toPath(), dir2.toPath());
}
use of java.nio.file.attribute.FileAttribute in project mycore by MyCoRe-Org.
the class MCRDirectoryStream method newByteChannel.
@Override
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
checkClosed();
MCRPath mcrPath = checkRelativePath(path);
if (mcrPath.isAbsolute()) {
return mcrPath.getFileSystem().provider().newByteChannel(mcrPath, options, attrs);
}
Set<? extends OpenOption> fileOpenOptions = options.stream().filter(option -> !(option == StandardOpenOption.CREATE || option == StandardOpenOption.CREATE_NEW)).collect(Collectors.toSet());
boolean create = options.contains(StandardOpenOption.CREATE);
boolean createNew = options.contains(StandardOpenOption.CREATE_NEW);
if (create || createNew) {
for (OpenOption option : fileOpenOptions) {
// check before we create any file instance
MCRFile.checkOpenOption(option);
}
}
MCRFileSystemProvider provider = (MCRFileSystemProvider) mcrPath.getFileSystem().provider();
MCRFileSystemUtils.getMCRFile(dir, mcrPath, create, createNew);
return provider.newByteChannel(this.path.resolve(mcrPath), fileOpenOptions, attrs);
}
Aggregations