Package org.uberfire.java.nio

Examples of org.uberfire.java.nio.IOException


            return internalCopy( in, out );
        } finally {
            try {
                in.close();
            } catch ( java.io.IOException e ) {
                throw new IOException( e );
            }
        }
    }
View Full Code Here


            while ( ( n = in.read( buf ) ) > 0 ) {
                out.write( buf, 0, n );
                read += n;
            }
        } catch ( java.io.IOException e ) {
            throw new IOException( e );
        }
        return read;
    }
View Full Code Here

                buffer.write( data, 0, read );
            }
            buffer.flush();
            return buffer.toByteArray();
        } catch ( java.io.IOException e ) {
            throw new IOException( e );
        } finally {
            try {
                in.close();
            } catch ( java.io.IOException e ) {
                throw new IOException( e );
            }
        }
    }
View Full Code Here

            while ( ( line = bufferedReader.readLine() ) != null ) {
                result.add( line );
            }
            return result;
        } catch ( java.io.IOException ex ) {
            throw new IOException( ex );
        } finally {
            if ( bufferedReader != null ) {
                try {
                    bufferedReader.close();
                } catch ( java.io.IOException e ) {
                    throw new IOException();
                }
            }
        }
    }
View Full Code Here

                out.write( bytes, ( len - rem ), n );
                rem -= n;
            }
            return path;
        } catch ( java.io.IOException e ) {
            throw new IOException( e );
        } finally {
            try {
                out.close();
            } catch ( java.io.IOException e ) {
                throw new IOException( e );
            }
        }
    }
View Full Code Here

            for ( final CharSequence line : lines ) {
                try {
                    bufferedWriter.append( line );
                    bufferedWriter.newLine();
                } catch ( java.io.IOException e ) {
                    throw new IOException();
                }
            }
        } catch ( final IOException ex ) {
            throw ex;
        } finally {
            if ( bufferedWriter != null ) {
                try {
                    bufferedWriter.close();
                } catch ( java.io.IOException e ) {
                    throw new IOException();
                }
            }
        }

        return path;
View Full Code Here

        walk(start, 0);
    }

    private FileVisitResult walk(final Path file, final int depth)
            throws IOException {
        IOException exc = null;
        BasicFileAttributes attrs = null;
        try {
            attrs = Files.readAttributes(file, BasicFileAttributes.class);
        } catch (IOException ex) {
            exc = ex;
        }

        if (exc != null) {
            return visitor.visitFileFailed(file, exc);
        }

        // at maximum depth or file is not a directory
        if (depth >= maxDepth || !attrs.isDirectory()) {
            return visitor.visitFile(file, attrs);
        }

        DirectoryStream<? extends Path> stream = null;
        FileVisitResult result = null;

        try {
            stream = Files.newDirectoryStream(file);
        } catch (IOException ex) {
            return visitor.visitFileFailed(file, ex);
        }

        IOException postException = null;

        try {
            result = visitor.preVisitDirectory(file, attrs);
            if (result != FileVisitResult.CONTINUE) {
                return result;
View Full Code Here

            IOException, SecurityException {
        waitFSUnlock( path );
        try {
            newByteChannel( path, CREATE_NEW_FILE_OPTIONS, attrs ).close();
        } catch ( java.io.IOException e ) {
            throw new IOException( e );
        }

        return path;
    }
View Full Code Here

        try {
            byteChannel.write( ByteBuffer.wrap( bytes ) );
            byteChannel.close();
        } catch ( final java.io.IOException e ) {
            throw new IOException( e );
        }

        return path;
    }
View Full Code Here

    public void testException() {
        final Path dir = newTempDir( null );

        final Path file = Files.createTempFile( dir, "foo", "bar" );

        final IOException myException = new IOException();

        try {
            simple.visitFileFailed( file, myException );
            fail( "should throw an exception" );
        } catch ( Exception ex ) {
View Full Code Here

TOP

Related Classes of org.uberfire.java.nio.IOException

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.