Package java.io

Examples of java.io.File.toPath()


            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


                "Either the address provided with 'jscsi_target-published_ip' is illegal or not contained within the available network interfaces.");
     
        File schemaFile = new File("jscsi-target.xsd");
       
        if(schemaFile.exists() == false){
            Files.copy(context.getBundle().getResource("/jscsi-target.xsd").openStream(), schemaFile.toPath());
        }
       
        System.out.println("Schemafile: " + ((schemaFile.exists())? "exists" : "does not exist"));
       
        File configFile = new File("jscsi-target.xml");
View Full Code Here

       
        System.out.println("Schemafile: " + ((schemaFile.exists())? "exists" : "does not exist"));
       
        File configFile = new File("jscsi-target.xml");
        if(configFile.exists() == false){
            Files.copy(context.getBundle().getResource("/jscsi-target.xml").openStream(), configFile.toPath());
        }
       
        System.out.println("Configfile: " + ((configFile.exists())? "exists" : "does not exist"));

        target = new TargetServer(Configuration.create(schemaFile, configFile, addr.getHostAddress()));
View Full Code Here

        File fileAtPos = new File(mBaseDir + File.separator + filePos);
        if (!fileAtPos.exists()) {
            fileAtPos.createNewFile();
            cachedBytes = new byte[mFileSize];
            Files.write(fileAtPos.toPath(), cachedBytes);
        } else if (cachedBytes == null) {
            cachedBytes = Files.readAllBytes(fileAtPos.toPath());
            mCache.put((int) filePos, cachedBytes);
        }
View Full Code Here

        if (!fileAtPos.exists()) {
            fileAtPos.createNewFile();
            cachedBytes = new byte[mFileSize];
            Files.write(fileAtPos.toPath(), cachedBytes);
        } else if (cachedBytes == null) {
            cachedBytes = Files.readAllBytes(fileAtPos.toPath());
            mCache.put((int) filePos, cachedBytes);
        }

        if ((storageOffset + bytes.length) > mFileSize) {
            System.arraycopy(cachedBytes, storageOffset, bytes, 0, mFileSize - storageOffset);
View Full Code Here

        chooser.setSelectedFile(preselected);
        if (chooser.showOpenDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
          lastCopyToDrawer = chooser.getSelectedFile().getParentFile();
          File dstFile = chooser.getSelectedFile();
          if (bMove) {
            Files.move(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
            node.setRemoved(true);
          }
          else {
            Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
          }
View Full Code Here

          if (bMove) {
            Files.move(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
            node.setRemoved(true);
          }
          else {
            Files.copy(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
          }

          ImagePanel pnl = pnlList.get(selectedPnl);
          SimpleImage img = pnl.getImage();
          TextTransformer txt = new TextTransformer();
View Full Code Here

        mock.expectedFileExists(fullTestFileName, testFileContent);

        template.sendBodyAndHeader("direct:write" + routeSuffix, testFileContent, Exchange.FILE_NAME, testFileName);

        File f = new File(fullTestFileName);
        Set<PosixFilePermission> permissions = Files.getPosixFilePermissions(f.toPath(), LinkOption.NOFOLLOW_LINKS);
        assertEquals(expectedPermissions, PosixFilePermissions.toString(permissions));
        assertEquals(expectedPermissions.replace("-", "").length(), permissions.size());

        assertMockEndpointsSatisfied();
    }
View Full Code Here

        File fileAtPos = new File(mBaseDir + File.separator + filePos);
        if (!fileAtPos.exists()) {
            fileAtPos.createNewFile();
            cachedBytes = new byte[mFileSize];
        } else if (cachedBytes == null) {
            cachedBytes = Files.readAllBytes(fileAtPos.toPath());
            cached = false;
        }

        if ((storageOffset + bytes.length) > mFileSize) {
            System.arraycopy(bytes, 0, cachedBytes, storageOffset, mFileSize - storageOffset);
View Full Code Here

            byte[] nextStep = new byte[bytes.length - (mFileSize - storageOffset)];
            System.arraycopy(bytes, (mFileSize - storageOffset), nextStep, 0, bytes.length - (mFileSize - storageOffset));
            write(nextStep, storageIndex + (mFileSize - storageOffset));
        } else {
            System.arraycopy(bytes, 0, cachedBytes, storageOffset, bytes.length);
            Files.write(fileAtPos.toPath(), cachedBytes);
        }

        if (!cached) {
            mCache.put((int) filePos, cachedBytes);
        }
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.