< prev index next >

src/java.base/share/classes/java/nio/channels/FileChannel.java

Print this page




 313      * @throws  UnsupportedOperationException
 314      *          If the {@code path} is associated with a provider that does not
 315      *          support creating file channels, or an unsupported open option is
 316      *          specified
 317      * @throws  IOException
 318      *          If an I/O error occurs
 319      * @throws  SecurityException
 320      *          If a security manager is installed and it denies an
 321      *          unspecified permission required by the implementation.
 322      *          In the case of the default provider, the {@link
 323      *          SecurityManager#checkRead(String)} method is invoked to check
 324      *          read access if the file is opened for reading. The {@link
 325      *          SecurityManager#checkWrite(String)} method is invoked to check
 326      *          write access if the file is opened for writing
 327      *
 328      * @since   1.7
 329      */
 330     public static FileChannel open(Path path, OpenOption... options)
 331         throws IOException
 332     {
 333         Set<OpenOption> set = new HashSet<OpenOption>(options.length);
 334         Collections.addAll(set, options);
 335         return open(path, set, NO_ATTRIBUTES);
 336     }
 337 
 338     // -- Channel operations --
 339 
 340     /**
 341      * Reads a sequence of bytes from this channel into the given buffer.
 342      *
 343      * <p> Bytes are read starting at this channel's current file position, and
 344      * then the file position is updated with the number of bytes actually
 345      * read.  Otherwise this method behaves exactly as specified in the {@link
 346      * ReadableByteChannel} interface. </p>
 347      */
 348     public abstract int read(ByteBuffer dst) throws IOException;
 349 
 350     /**
 351      * Reads a sequence of bytes from this channel into a subsequence of the
 352      * given buffers.
 353      *




 313      * @throws  UnsupportedOperationException
 314      *          If the {@code path} is associated with a provider that does not
 315      *          support creating file channels, or an unsupported open option is
 316      *          specified
 317      * @throws  IOException
 318      *          If an I/O error occurs
 319      * @throws  SecurityException
 320      *          If a security manager is installed and it denies an
 321      *          unspecified permission required by the implementation.
 322      *          In the case of the default provider, the {@link
 323      *          SecurityManager#checkRead(String)} method is invoked to check
 324      *          read access if the file is opened for reading. The {@link
 325      *          SecurityManager#checkWrite(String)} method is invoked to check
 326      *          write access if the file is opened for writing
 327      *
 328      * @since   1.7
 329      */
 330     public static FileChannel open(Path path, OpenOption... options)
 331         throws IOException
 332     {
 333         Set<OpenOption> set = new HashSet<>(options.length);
 334         Collections.addAll(set, options);
 335         return open(path, set, NO_ATTRIBUTES);
 336     }
 337 
 338     // -- Channel operations --
 339 
 340     /**
 341      * Reads a sequence of bytes from this channel into the given buffer.
 342      *
 343      * <p> Bytes are read starting at this channel's current file position, and
 344      * then the file position is updated with the number of bytes actually
 345      * read.  Otherwise this method behaves exactly as specified in the {@link
 346      * ReadableByteChannel} interface. </p>
 347      */
 348     public abstract int read(ByteBuffer dst) throws IOException;
 349 
 350     /**
 351      * Reads a sequence of bytes from this channel into a subsequence of the
 352      * given buffers.
 353      *


< prev index next >