Package org.uberfire.java.nio.file

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


        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 );

        File.createTempFile( "foo", "bar", dir.toFile() );
        File.createTempFile( "bar", "foo", dir.toFile() );
        File.createTempFile( "bar", "foo", dir.toFile() );
View Full Code Here


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

        File.createTempFile( "foo", "bar", dir.toFile() );
        File.createTempFile( "bar", "foo", dir.toFile() );
        File.createTempFile( "bar", "foo", dir.toFile() );
        fsProvider.createDirectory( dir.resolve( "other_dir" ) );

        final DirectoryStream<Path> stream5 = fsProvider.newDirectoryStream( dir, new DirectoryStream.Filter<Path>() {
View Full Code Here

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

        File.createTempFile( "foo", "bar", dir.toFile() );
        File.createTempFile( "bar", "foo", dir.toFile() );
        File.createTempFile( "bar", "foo", dir.toFile() );
        fsProvider.createDirectory( dir.resolve( "other_dir" ) );

        final DirectoryStream<Path> stream5 = fsProvider.newDirectoryStream( dir, new DirectoryStream.Filter<Path>() {
            @Override
View Full Code Here

        FileUtils.deleteDirectory( dir.toFile() );
        fsProvider.createDirectory( dir );

        File.createTempFile( "foo", "bar", dir.toFile() );
        File.createTempFile( "bar", "foo", dir.toFile() );
        File.createTempFile( "bar", "foo", dir.toFile() );
        fsProvider.createDirectory( dir.resolve( "other_dir" ) );

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

        } catch ( final DirectoryNotEmptyException expection ) {
        }

        fsProvider.delete( dir, NON_EMPTY_DIRECTORIES );

        assertThat( dir.toFile().exists() ).isEqualTo( false );
    }

    @Test(expected = NotDirectoryException.class)
    public void newDirectoryStreamInvalidDir() throws IOException {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();
View Full Code Here

        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();

        final String userBasedPath = System.getProperty( "user.dir" ) + "/byte_some_file_here.txt";

        final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), userBasedPath, false );
        assertThat( path.toFile().exists() ).isFalse();

        final SeekableByteChannel channel = fsProvider.newByteChannel( path, null );

        assertThat( channel ).isNotNull();
        assertThat( path.toFile().exists() ).isTrue();
View Full Code Here

        assertThat( path.toFile().exists() ).isFalse();

        final SeekableByteChannel channel = fsProvider.newByteChannel( path, null );

        assertThat( channel ).isNotNull();
        assertThat( path.toFile().exists() ).isTrue();
        path.toFile().delete();
        assertThat( path.toFile().exists() ).isFalse();
    }

    @Test(expected = FileAlreadyExistsException.class)
View Full Code Here

        final SeekableByteChannel channel = fsProvider.newByteChannel( path, null );

        assertThat( channel ).isNotNull();
        assertThat( path.toFile().exists() ).isTrue();
        path.toFile().delete();
        assertThat( path.toFile().exists() ).isFalse();
    }

    @Test(expected = FileAlreadyExistsException.class)
    public void newByteChannelFileAlreadyExists() throws IOException {
View Full Code Here

        final SeekableByteChannel channel = fsProvider.newByteChannel( path, null );

        assertThat( channel ).isNotNull();
        assertThat( path.toFile().exists() ).isTrue();
        path.toFile().delete();
        assertThat( path.toFile().exists() ).isFalse();
    }

    @Test(expected = FileAlreadyExistsException.class)
    public void newByteChannelFileAlreadyExists() throws IOException {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();
View Full Code Here

        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();

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

        assertThat( path.toFile().exists() ).isTrue();
        assertThat( path.toFile() ).isEqualTo( tempFile );

        fsProvider.newByteChannel( path, null );
    }
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.