Package java.io

Examples of java.io.File.toPath()


        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


        throws Throwable
    {

        File file = new File( System.getProperty( "buildDirectory" ), "foo.txt" );

        Files.deleteIfExists( file.toPath() );

        File largeJar = new File( System.getProperty( "basedir" ), "src/test/cassandra-all-2.0.3.jar" );

        Lock lock = fileLockManager.writeFileLock( file );
View Full Code Here

        File largeJar = new File( System.getProperty( "basedir" ), "src/test/cassandra-all-2.0.3.jar" );

        Lock lock = fileLockManager.writeFileLock( file );

        Files.copy( largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING );

        lock = fileLockManager.writeFileLock( file );

    }
View Full Code Here

            newName += EXTENTION_WITH_DOT;
            //name = newName.substring(0, newName.length() - EXTENTION_WITH_DOT.length());
        }
        File file = new File(newName);
        name = file.getName();
        pathToBuildFile = file.toPath();
    }
   
    public void setSourceFolder(String newName)
    {
        srcFolderName = newName;
View Full Code Here

              ArchiveStreamFactory.JAR, os)) {

        // If project is a war project add the war to the project
        if ("war".equalsIgnoreCase(project.getPackaging())) {
          File projectArtifact = project.getArtifact().getFile();
          if (projectArtifact != null && Files.exists(projectArtifact.toPath())) {
            aos.putArchiveEntry(new JarArchiveEntry(projectArtifact.getName()));
            try (InputStream is = Files.newInputStream(projectArtifact.toPath())) {
              IOUtils.copy(is, aos);
            }
            aos.closeArchiveEntry();
View Full Code Here

        // If project is a war project add the war to the project
        if ("war".equalsIgnoreCase(project.getPackaging())) {
          File projectArtifact = project.getArtifact().getFile();
          if (projectArtifact != null && Files.exists(projectArtifact.toPath())) {
            aos.putArchiveEntry(new JarArchiveEntry(projectArtifact.getName()));
            try (InputStream is = Files.newInputStream(projectArtifact.toPath())) {
              IOUtils.copy(is, aos);
            }
            aos.closeArchiveEntry();
          }
        }
View Full Code Here

              throw new MojoExecutionException(e.getMessage(), e);
            }

            File extraWarFile = result.getArtifact().getFile();
            aos.putArchiveEntry(new JarArchiveEntry(extraWarFile.getName()));
            try (InputStream is = Files.newInputStream(extraWarFile.toPath())) {
              IOUtils.copy(is, aos);
            }
            aos.closeArchiveEntry();

          }
View Full Code Here

                String dirName = f.toPath().getFileName().toString();
                String ver = isJavaDir(dirName);
                if (ver != null && (!jdk || isJDK(dirName))) {
                    File home = searchJavaHomeInDir(f);
                    if (home != null)
                        dirs.put(javaVersion(ver), home.toPath());
                }
            }
        }
        return !dirs.isEmpty() ? dirs : null;
    }
View Full Code Here

  /** Creates an IndexInput for the file with the given name. */
  @Override
  public IndexInput openInput(String name, IOContext context) throws IOException {
    ensureOpen();
    File path = new File(getDirectory(), name);
    FileChannel fc = FileChannel.open(path.toPath(), StandardOpenOption.READ);
    return new NIOFSIndexInput("NIOFSIndexInput(path=\"" + path + "\")", fc, context);
  }
 
  /**
   * Reads bytes with {@link FileChannel#read(ByteBuffer, long)}
View Full Code Here

  /** Creates an IndexInput for the file with the given name. */
  @Override
  public IndexInput openInput(String name, IOContext context) throws IOException {
    ensureOpen();
    File file = new File(getDirectory(), name);
    try (FileChannel c = FileChannel.open(file.toPath(), StandardOpenOption.READ)) {
      final String resourceDescription = "MMapIndexInput(path=\"" + file.toString() + "\")";
      final boolean useUnmap = getUseUnmap();
      return ByteBufferIndexInput.newInstance(resourceDescription,
          map(resourceDescription, c, 0, c.size()),
          c.size(), chunkSizePower, useUnmap ? CLEANER : null, useUnmap);
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.