Package java.nio.file

Examples of java.nio.file.FileSystem


    private final String ext;
    private final Map<Path, Path> files;

    public NewFileVisitor(Path outputPath, String pattern, String ext,
            Map<Path, Path> files) {
        FileSystem fileSystem = FileSystems.getDefault();
        String fullPattern = pattern;
        if (!pattern.startsWith("glob:") && !pattern.startsWith("regex:")) {
            fullPattern = "glob:" + pattern;
        }
        this.outputPath = outputPath;
        this.ext = ext;
        this.matcher = fileSystem.getPathMatcher(fullPattern);
        this.files = files;
    }
View Full Code Here


            List<Path> files = listJars(webInfLibDirectory);

            for (Path p : files) {
                info("LOCATED JAR " + p.toFile().getName());
                jarURLs.add(p.toUri().toURL());
                FileSystem fs = provider.newFileSystem(p, new HashMap<String, Object>());
                Path serviceDirectory = fs.getPath("/META-INF", "services");
                info("SCANNING SERVICES");

                if (Files.exists(serviceDirectory)) {
                    DirectoryStream<Path> serviceListings = Files.newDirectoryStream(serviceDirectory);
View Full Code Here

    public TemporaryFolder temporaryFolder = new TemporaryFolder();

    @Before
    public void setup() throws Exception {
        JavaArchive homeArchive = ShrinkWrap.create(JavaArchive.class);
        FileSystem vfs = ShrinkWrapFileSystems.newFileSystem(homeArchive);
        PathManager.getInstance().useOverrideHomePath(temporaryFolder.getRoot().toPath());
        PathManager.getInstance().setCurrentSaveTitle("testSave");

        assert !Files.isRegularFile(vfs.getPath("global.dat"));

        moduleManager = ModuleManagerFactory.create();
        networkSystem = mock(NetworkSystem.class);
        when(networkSystem.getMode()).thenReturn(NetworkMode.NONE);
        CoreRegistry.put(ModuleManager.class, moduleManager);
View Full Code Here

     * @throws IOException ShrinkWrap errors
     */
    @Override
    protected void setupPathManager() throws IOException {
        final JavaArchive homeArchive = ShrinkWrap.create(JavaArchive.class);
        final FileSystem vfs = ShrinkWrapFileSystems.newFileSystem(homeArchive);
        PathManager.getInstance().useOverrideHomePath(vfs.getPath(""));
        PathManager.getInstance().setCurrentSaveTitle("world1");
    }
View Full Code Here

    private EngineTime mockTime;

    @BeforeClass
    public static void setupEnvironment() throws Exception {
        final JavaArchive homeArchive = ShrinkWrap.create(JavaArchive.class);
        final FileSystem vfs = ShrinkWrapFileSystems.newFileSystem(homeArchive);
        PathManager.getInstance().useOverrideHomePath(vfs.getPath(""));

        if (!setup) {
            setup = true;

            env = new DisplayEnvironment();
View Full Code Here

    // Conversions to and from java.io
    File workingPathAsFile = workingPath.toFile();
    Assert.assertEquals(workingPath, workingPathAsFile.toPath());
   
    // FileStore
    FileSystem fileSystem = workingPath.getFileSystem();
    Iterator<Path> rootDirectories = fileSystem.getRootDirectories().iterator();
    Assert.assertEquals(Paths.get("C:\\"), rootDirectories.next());
    Assert.assertEquals(Paths.get("D:\\"), rootDirectories.next());
   
    // Create path relative to other
    Path testPath = workingPath.resolve("target/testDir");
View Full Code Here

  }

  @Override
  public Path file(String path, String content) {
    Path file = super.file(path, content);
    FileSystem fileSystem = file.getFileSystem();

    // We have to force the write to disk.
    // ZipFileSystem doesn't respect the SYNC flag.
    try {
      call("beginWrite", fileSystem);
View Full Code Here

  private static Path getJarPath(File jar) {
    URI uri = URI.create("jar:" + jar.toURI().toString());
    Map<String, String> env = new HashMap<>();
    env.put("create", "true");
    FileSystem fileSystem;
    try {
      fileSystem = FileSystems.newFileSystem(uri, env);
    } catch (IOException e) {
      throw uncheck(e);
    }
    return fileSystem.getPath("/");
  }
View Full Code Here

      if (e.isPopupTrigger()) {
        rightClickMouseMenu.show(e.getComponent(), e.getX(), e.getY());
      }
    }
    public void onLoadImage() {
      FileSystem fs = FileSystems.getDefault();
      path = fs.getPath("/home/max/IdeaProjects/designpatternjava/src/MVCTableDAO/images/");
      JFileChooser chooser = new JFileChooser("/home/max/IdeaProjects/designpatternjava/src/MVCTableDAO/images/");
      int returnValue = chooser.showOpenDialog(null);
      byte[] data;
      if(returnValue == JFileChooser.APPROVE_OPTION) {
        try {
View Full Code Here

    DirectoryStream<Path> children = Files.newDirectoryStream(directory);
    for(Path child : children){
      process(StandardWatchEventKinds.ENTRY_CREATE, child);
    }

    FileSystem fileSystem = directory.getFileSystem();

    WatchService watcher = fileSystem.newWatchService();

    try {
      WatchKey key = directory.register(watcher, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE);
      if(key.isValid()){
        process(key);
View Full Code Here

TOP

Related Classes of java.nio.file.FileSystem

Copyright © 2018 www.massapicom. 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.