Package java.io

Examples of java.io.File.toPath()


            dest = new File(getTomcatInstance().getHost().getAppBaseFile(),
                APP_NAME.getBaseName() + ".war");
        } else {
            dest = new File(external, "external" + ".war");
        }
        Files.copy(src.toPath(), dest.toPath());
        return dest;
    }

    private File createXmlInConfigBaseForAppbase() throws IOException {
        File xml = getXmlInConfigBaseForAppbase();
View Full Code Here


        }

        // Copy the WAR file
        File war = new File(host.getAppBaseFile(),
                APP_NAME.getBaseName() + ".war");
        Files.copy(WAR_XML_SOURCE.toPath(), war.toPath());

        // Deploy the copied war
        tomcat.start();
        host.backgroundProcess();
View Full Code Here

        try
        {
            // MavenXpp3Reader leaves the file open, so we need to close it ourselves.

            Model model = null;
            try (Reader reader = Files.newBufferedReader( pom.toPath(), Charset.defaultCharset() ))
            {
                model = MAVEN_XPP_3_READER.read( reader );
            }

            DistributionManagement dist = model.getDistributionManagement();
View Full Code Here

        File localFile = new File( localResource, resource.getDisplayName() );
        boolean exists = localFile.exists();

        if ( isCollection() && inputContext.hasStream() ) // New File
        {
            try (OutputStream stream = Files.newOutputStream( localFile.toPath() ))
            {
                IOUtils.copy( inputContext.getInputStream(), stream );
            }
            catch ( IOException e )
            {
View Full Code Here

            Map<Integer,Set<String>> lists = new TreeMap<Integer,Set<String>>();
            for (int i = 1; i <= 4; i++)
                lists.put(i, new TreeSet<String>());

            File rt_jar_lst = new File(args[1]);
            for (String line: Files.readAllLines(rt_jar_lst.toPath(), Charset.defaultCharset())) {
                if (line.endsWith(".class")) {
                    String type = line.substring(0, line.length() - 6);
                    int profile = p.getProfile(type);
                    for (int i = profile; i <= 4; i++)
                        lists.get(i).add(type);
View Full Code Here

  public void testListensInNewDirectories() throws IOException, InterruptedException,
      ExecutionException {
    File rootDirectory = Files.createTempDir();

    ChangedFileAccumulator changedFileAccumulator =
        new ChangedFileAccumulator(rootDirectory.toPath());

    assertTrue(changedFileAccumulator.getAndClearChangedFiles().isEmpty());

    // Create a new directory and contained file AFTER the root directory has started being listened
    // to.
View Full Code Here

    assertTrue(changedFileAccumulator.getAndClearChangedFiles().isEmpty());

    // Symlink in a loop
    java.nio.file.Files.createSymbolicLink(new File(rootDirectory, "sublink").toPath(),
        subDirectory.toPath()).toFile();
    java.nio.file.Files.createSymbolicLink(new File(subDirectory, "sublink").toPath(),
        rootDirectory.toPath()).toFile();
    createFileIn("New.java", subDirectory);
    waitForFileEvents();
View Full Code Here

    assertTrue(changedFileAccumulator.getAndClearChangedFiles().isEmpty());

    // Symlink in a subdirectory and then symlink in a contained file.
    java.nio.file.Files.createSymbolicLink(new File(rootDirectory, "sublink").toPath(),
        subDirectory.toPath()).toFile();
    java.nio.file.Files.createSymbolicLink(new File(subDirectory, "New.java").toPath(),
        newFile.toPath()).toFile();
    waitForFileEvents();

    List<File> modifiedFiles = changedFileAccumulator.getAndClearChangedFiles();
View Full Code Here

              //It's not the original
              addFailure(dlcName, "DLC hash does not match known original");
              return false;
            }
          }
          Files.copy(mainSfar.toPath(), backupSfar.toPath(), StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException e) {
          addFailure(dlcName, "I/O Exception occured");
          e.printStackTrace();
          return false;
        } catch (Exception e) {
View Full Code Here

            }
            File metaInf = new File(file, "META-INF");
            if (!metaInf.isDirectory()) {
                return;
            }
            Files.walkFileTree(metaInf.toPath(), new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult visitFile(Path file,
                                                 BasicFileAttributes attrs)
                        throws IOException {
                    if (!file.endsWith(TLD_EXT)) {
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.