Package org.uberfire.java.nio.file

Examples of org.uberfire.java.nio.file.Path.toFile()


    public void createDirectory( final Path dir,
                                 final FileAttribute<?>... attrs )
            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {
        checkNotNull( "dir", dir );
        final Path realDir = dir.toAbsolutePath();
        if ( realDir.toFile().exists() ) {
            throw new FileAlreadyExistsException( dir.toString() );
        }
        realDir.toFile().mkdirs();
    }
View Full Code Here


        checkNotNull( "dir", dir );
        final Path realDir = dir.toAbsolutePath();
        if ( realDir.toFile().exists() ) {
            throw new FileAlreadyExistsException( dir.toString() );
        }
        realDir.toFile().mkdirs();
    }

    @Override
    public DirectoryStream<Path> newDirectoryStream( final Path dir,
                                                     final DirectoryStream.Filter<Path> filter )
View Full Code Here

        fsProvider.createDirectory( source );

        fsProvider.move( source, dest );

        assertThat( source.toFile().exists() ).isFalse();
        assertThat( dest.toFile().exists() ).isTrue();

        dest.toFile().delete();
    }

    @Test
View Full Code Here

        fsProvider.move( source, dest );

        assertThat( source.toFile().exists() ).isFalse();
        assertThat( dest.toFile().exists() ).isTrue();

        dest.toFile().delete();
    }

    @Test
    public void checkMoveFile() throws IOException {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();
View Full Code Here

        stream.close();

        long lenght = source.toFile().length();
        fsProvider.move( source, dest );

        assertThat( dest.toFile().exists() ).isTrue();
        assertThat( source.toFile().exists() ).isFalse();
        assertThat( dest.toFile().length() ).isEqualTo( lenght );

        dest.toFile().delete();
    }
View Full Code Here

        long lenght = source.toFile().length();
        fsProvider.move( source, dest );

        assertThat( dest.toFile().exists() ).isTrue();
        assertThat( source.toFile().exists() ).isFalse();
        assertThat( dest.toFile().length() ).isEqualTo( lenght );

        dest.toFile().delete();
    }

    @Test
View Full Code Here

        assertThat( dest.toFile().exists() ).isTrue();
        assertThat( source.toFile().exists() ).isFalse();
        assertThat( dest.toFile().length() ).isEqualTo( lenght );

        dest.toFile().delete();
    }

    @Test
    public void moveFileInvalidSourceAndTarget() throws IOException {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();
View Full Code Here

            fsProvider.move( source, dest );
            fail( "source isn't empty" );
        } catch ( Exception ex ) {
        }

        sourceFile.toFile().delete();
        fsProvider.copy( source, dest );

        try {
            fsProvider.move( source, dest );
            fail( "dest already exists" );
View Full Code Here

        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();

        final String userSourcePath = System.getProperty( "user.dir" ) + "/temp";

        final Path dir = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), userSourcePath, false );
        FileUtils.deleteDirectory( dir.toFile() );
        fsProvider.createDirectory( dir );

        final DirectoryStream<Path> stream = fsProvider.newDirectoryStream( dir, new DirectoryStream.Filter<Path>() {
            @Override
            public boolean accept( Path entry ) throws org.uberfire.java.nio.IOException {
View Full Code Here

            stream.iterator().next();
            fail( "can't navigate to next on empty iterator" );
        } catch ( NoSuchElementException ex ) {
        }

        final File tempFile = File.createTempFile( "foo", "bar", dir.toFile() );
        final Path path = GeneralPathImpl.newFromFile( fsProvider.getFileSystem( URI.create( "file:///" ) ), tempFile );

        final DirectoryStream<Path> stream2 = fsProvider.newDirectoryStream( dir, new DirectoryStream.Filter<Path>() {
            @Override
            public boolean accept( Path entry ) throws org.uberfire.java.nio.IOException {
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.