@Override public SeekableByteChannel newByteChannel( final Path path, final OpenOption... options ) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { return Files.newByteChannel( path, options ); }
@Override public SeekableByteChannel newByteChannel( final Path path, final Set<? extends OpenOption> options, final FileAttribute<?>... attrs ) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { return Files.newByteChannel( path, options, attrs ); }
/** * @throws IllegalArgumentException * @throws UnsupportedOperationException * @throws FileAlreadyExistsException * @throws IOException * @throws SecurityException * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newByteChannel(java.nio.file.Path, java.nio.file.OpenOption...)">Original JavaDoc</a> */ public static SeekableByteChannel newByteChannel( final Path path, final OpenOption... options ) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull( "path", path ); final Set<OpenOption> set = new HashSet<OpenOption>( options.length ); addAll( set, options ); return newByteChannel( path, set ); }
/** * @throws IllegalArgumentException * @throws UnsupportedOperationException * @throws FileAlreadyExistsException * @throws IOException * @throws SecurityException * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createFile(java.nio.file.Path, java.nio.file.attribute.FileAttribute...)">Original JavaDoc</a> */ public static Path createFile( final Path path, final FileAttribute<?>... attrs ) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull( "path", path ); try { newByteChannel( path, CREATE_NEW_FILE_OPTIONS, attrs ).close(); } catch ( java.io.IOException e ) { throw new IOException( e ); } return path; }
@Override public synchronized SeekableByteChannel newByteChannel( final Path path, final Set<? extends OpenOption> options, final FileAttribute<?>... attrs ) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull( "path", path ); final Properties properties = new Properties(); if ( exists( dot( path ) ) ) { properties.load( newInputStream( dot( path ) ) ); } final FileAttribute<?>[] allAttrs = consolidate( properties, attrs ); final SeekableByteChannel result = Files.newByteChannel( path, buildOptions( options ), allAttrs ); if ( isFileScheme( path ) ) { buildDotFile( path, newOutputStream( dot( path ) ), allAttrs ); } return result; }