Examples of toPath()


Examples of java.io.File.toPath()

        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

Examples of java.io.File.toPath()

        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

Examples of java.io.File.toPath()

          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

Examples of java.io.File.toPath()

        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

Examples of java.io.File.toPath()

        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

Examples of java.io.File.toPath()

            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

Examples of java.io.File.toPath()

            result_ok = false;
            posix_errno = Posix.ENOENT;
            return;
          }
         
          Path path = file.toPath();
          PosixFileAttributes attrs;
          try {
            attrs = Files.readAttributes(path, PosixFileAttributes.class, LinkOption.NOFOLLOW_LINKS);

          } catch (IOException e) {
View Full Code Here

Examples of java.io.File.toPath()

    File dir = new File(System.getenv("beaker_tmp_dir"));
    File tmp = File.createTempFile(base, suffix, dir);
    if (!windows()) {
      Set<PosixFilePermission> perms = EnumSet.of(PosixFilePermission.OWNER_READ,
                                                  PosixFilePermission.OWNER_WRITE);
      Files.setPosixFilePermissions(tmp.toPath(), perms);
    }
    return tmp.getAbsolutePath();
  }

  private BufferedWriter openTemp(String location)
View Full Code Here

Examples of java.io.File.toPath()

      shell.execute("cd " + testFolder, 5, TimeUnit.SECONDS);
      shell.execute("touch " + file, 5, TimeUnit.SECONDS);
      shell.execute("cd ..", 5, TimeUnit.SECONDS);

      File fileSource = new File(tmpDir, file);
      Files.write(fileSource.toPath(), "TEST".getBytes());
      File fileTarget = new File(new File(tmpDir, testFolder), file);
      Assert.assertTrue(fileSource.exists());
      Assert.assertTrue(fileTarget.exists());
      shell.execute("cp " + file + " " + testFolder, 5, TimeUnit.MINUTES);
      Assert.assertTrue(fileSource.exists());
View Full Code Here

Examples of java.io.File.toPath()

   public void testJsonResourceDataRead() throws Exception
   {
      File tmpFile = File.createTempFile("parser_json_test", ".json");
      tmpFile.deleteOnExit();
      String jsonData = "{\"firstName\": \"George\", \"lastName\": \"Gastaldi\"}";
      Files.write(tmpFile.toPath(), jsonData.getBytes());
      Resource<File> resource = resourceFactory.create(tmpFile);
      Assert.assertThat(resource, CoreMatchers.instanceOf(JsonResource.class));
      JsonResource jsonResource = resource.reify(JsonResource.class);
      JsonObject jsonObject = jsonResource.getJsonObject();
      Assert.assertNotNull(jsonObject);
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.