Package java.io

Examples of java.io.File.toPath()


          }
          publish(jobName + ": Hash of backup sfar is " + backupSfarHash);
          if (backupSfarHash.equals(sfarHashes.get(jobName))) {
            // This DLC sfar matches the known original - let's copy it to Default.sfar
            publish(jobName + ": Restoring backup sfar to Default.sfar");
            Files.copy(backupSfar.toPath(), mainSfar.toPath(), StandardCopyOption.REPLACE_EXISTING);
            return true;
          } else {
            // DLC is modified but we don't have a backup
            if (ModManager.logging){
              ModManager.debugLogger.writeMessage(jobName + ": Backup hash doesn't match known original, unable to automatically restore");
View Full Code Here


            File metaInf = new File(file, "META-INF");
            if (!metaInf.isDirectory()) {
                return;
            }
            final Path filePath = file.toPath();
            Files.walkFileTree(metaInf.toPath(), new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult visitFile(Path file,
                                                 BasicFileAttributes attrs)
                        throws IOException {
                    if (!file.getFileName().toString()
View Full Code Here

        {
            throw new IllegalArgumentException("File '"+fileLocation+"' is not a regular file.");
        }
        try
        {
            Set<PosixFilePermission> permissions = Files.getPosixFilePermissions(file.toPath());

            if (permissions.contains(PosixFilePermission.GROUP_READ)
                || permissions.contains(PosixFilePermission.OTHERS_READ)
                || permissions.contains(PosixFilePermission.GROUP_WRITE)
                || permissions.contains(PosixFilePermission.OTHERS_WRITE))
View Full Code Here

                throw new IllegalArgumentException("Key file '"
                                                + fileLocation
                                                + "' has incorrect permissions.  Only the owner "
                                                + "should be able to read or write this file.");
            }
            if(Files.size(file.toPath()) != AES_KEY_SIZE_BYTES)
            {
                throw new IllegalArgumentException("Key file '" + fileLocation + "' contains an incorrect about of data");
            }

            try(FileInputStream inputStream = new FileInputStream(file))
View Full Code Here

            Files.createDirectories(Paths.get(_tmpDir.toString(), subdirName));

            File file = new File(fileLocation);
            file.createNewFile();
            Files.setPosixFilePermissions(file.toPath(),
                                          EnumSet.of(PosixFilePermission.OWNER_READ, PosixFilePermission.GROUP_READ));

            try
            {
                ConfigurationSecretEncrypter encrypter = _factory.createEncrypter(_broker);
View Full Code Here

            try (FileOutputStream fos = new FileOutputStream(file))
            {
                fos.write("This is not an AES key.  It is a string saying it is not an AES key".getBytes(
                        StandardCharsets.US_ASCII));
            }
            Files.setPosixFilePermissions(file.toPath(), EnumSet.of(PosixFilePermission.OWNER_READ));

            try
            {
                ConfigurationSecretEncrypter encrypter = _factory.createEncrypter(_broker);
                fail("should not be able to start where the key is not a valid key");
View Full Code Here

        File filePath = new File(getClass().getResource("page.html").toURI());
        File rootPath = filePath.getParentFile();

        File newDir = new File(rootPath, "newDir");
        newDir.mkdir();
        Path newDirPath = newDir.toPath();

        File innerDir = new File(newDir, "innerDir");
        innerDir.mkdir();
        Path innerDirPath = innerDir.toPath();
View Full Code Here

        newDir.mkdir();
        Path newDirPath = newDir.toPath();

        File innerDir = new File(newDir, "innerDir");
        innerDir.mkdir();
        Path innerDirPath = innerDir.toPath();

        Files.copy(filePath.toPath(), newDirPath.resolve(filePath.toPath().getFileName()));
        Files.copy(filePath.toPath(), innerDirPath.resolve(filePath.toPath().getFileName()));

        File newSymlink = new File(rootPath, "newSymlink");
View Full Code Here

        Files.copy(filePath.toPath(), newDirPath.resolve(filePath.toPath().getFileName()));
        Files.copy(filePath.toPath(), innerDirPath.resolve(filePath.toPath().getFileName()));

        File newSymlink = new File(rootPath, "newSymlink");
        Path newSymlinkPath = newSymlink.toPath();

        Files.createSymbolicLink(newSymlinkPath, newDirPath);

        File innerSymlink = new File(newDir, "innerSymlink");
        Path innerSymlinkPath = innerSymlink.toPath();
View Full Code Here

        Path newSymlinkPath = newSymlink.toPath();

        Files.createSymbolicLink(newSymlinkPath, newDirPath);

        File innerSymlink = new File(newDir, "innerSymlink");
        Path innerSymlinkPath = innerSymlink.toPath();

        Files.createSymbolicLink(innerSymlinkPath, innerDirPath);
    }

    @After
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.