Lines Matching refs:file

8  * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
14 * version 2 for more details (a copy is included in the LICENSE file that
28 import java.nio.file.*;
29 import java.nio.file.attribute.FileAttribute;
30 import java.nio.file.spi.*;
40 * An asynchronous channel for reading, writing, and manipulating a file.
42 * <p> An asynchronous file channel is created when a file is opened by invoking
43 * one of the {@link #open open} methods defined by this class. The file contains
45 * current size can be {@link #size() queried}. The size of the file increases
46 * when bytes are written beyond its current size; the size of the file decreases
49 * <p> An asynchronous file channel does not have a <i>current position</i>
50 * within the file. Instead, the file position is specified to each read and
63 * <li><p> Updates made to a file may be {@link #force <i>forced
67 * <li><p> A region of a file may be {@link #lock <i>locked</i>} against
100 * <p> As with {@link FileChannel}, the view of a file provided by an instance of
101 * this class is guaranteed to be consistent with other views of the same file
124 * Opens or creates a file for reading and/or writing, returning an
125 * asynchronous file channel to access the file.
127 * <p> The {@code options} parameter determines how the file is opened.
129 * WRITE} options determines if the file should be opened for reading and/or
130 * writing. If neither option is contained in the array then an existing file
140 * <td> When opening an existing file, the file is first truncated to a
141 * size of 0 bytes. This option is ignored when the file is opened only
146 * <td> If this option is present then a new file is created, failing if
147 * the file already exists. When creating a file the check for the
148 * existence of the file and the creation of the file if it does not exist
149 * is atomic with respect to other file system operations. This option is
150 * ignored when the file is opened only for reading. </td>
154 * <td> If this option is present then an existing file is opened if it
155 * exists, otherwise a new file is created. When creating a file the check
156 * for the existence of the file and the creation of the file if it does
157 * not exist is atomic with respect to other file system operations. This
159 * the file is opened only for reading. </td>
164 * <em>best effort</em> attempt to delete the file when closed by the
166 * invoked then a <em>best effort</em> attempt is made to delete the file
171 * <td> When creating a new file this option is a <em>hint</em> that the
172 * new file will be sparse. This option is ignored when not creating
173 * a new file. </td>
177 * <td> Requires that every update to the file's content or metadata be
179 * href="../file/package-summary.html#integrity"> Synchronized I/O file
184 * <td> Requires that every update to the file's content be written
186 * href="../file/package-summary.html#integrity"> Synchronized I/O file
203 * <p> The {@code attrs} parameter is an optional array of file {@link
204 * FileAttribute file-attributes} to set atomically when creating the file.
210 * @param file
211 * The path of the file to open or create
213 * Options specifying how the file is opened
218 * An optional list of file attributes to set atomically when
219 * creating the file
221 * @return A new asynchronous file channel
226 * If the {@code file} is associated with a provider that does not
227 * support creating asynchronous file channels, or an unsupported
229 * cannot be set atomically when creating the file
237 * read access if the file is opened for reading. The {@link
239 * write access if the file is opened for writing
241 public static AsynchronousFileChannel open(Path file,
247 FileSystemProvider provider = file.getFileSystem().provider();
248 return provider.newAsynchronousFileChannel(file, options, executor, attrs);
254 * Opens or creates a file for reading and/or writing, returning an
255 * asynchronous file channel to access the file.
261 * open}(file, opts, null, new FileAttribute&lt;?&gt;[0]);
271 * @param file
272 * The path of the file to open or create
274 * Options specifying how the file is opened
276 * @return A new asynchronous file channel
281 * If the {@code file} is associated with a provider that does not
282 * support creating file channels, or an unsupported open option is
291 * read access if the file is opened for reading. The {@link
293 * write access if the file is opened for writing
295 public static AsynchronousFileChannel open(Path file, OpenOption... options)
300 return open(file, set, null, NO_ATTRIBUTES);
304 * Returns the current size of this channel's file.
306 * @return The current size of this channel's file, measured in bytes
316 * Truncates this channel's file to the given size.
318 * <p> If the given size is less than the file's current size then the file
319 * is truncated, discarding any bytes beyond the new end of the file. If
320 * the given size is greater than or equal to the file's current size then
321 * the file is not modified. </p>
326 * @return This file channel
343 * Forces any updates to this channel's file to be written to the storage
346 * <p> If this channel's file resides on a local storage device then when
347 * this method returns it is guaranteed that all changes made to the file
352 * <p> If the file does not reside on a local device then no such guarantee
358 * file's content need be written to storage; passing {@code true}
359 * indicates that updates to both the file's content and metadata must be
366 * example, maintain a last-access time as part of a file's metadata, and
367 * this time is updated whenever the file is read. Whether or not this is
371 * this channel's file via the methods defined in this class.
375 * to both the file's content and metadata to be written to
388 * Acquires a lock on the given region of this channel's file.
391 * region of this channel's file. The {@code handler} parameter is a
398 * underlying file. Lock regions are fixed in size; if a locked region
399 * initially contains the end of the file and the file grows beyond the
400 * region then the new portion of the file will not be covered by the lock.
401 * If a file is expected to grow in size and a lock on the entire file is
403 * expected maximum size of the file, should be locked. The two-argument
410 * <p> Some operating systems do not support a mechanism to acquire a file
412 * acquire the file lock in a background thread or from a task executed by
424 * They are not suitable for controlling access to a file by multiple
461 * Acquires an exclusive lock on this channel's file.
464 * region of this channel's file. The {@code handler} parameter is a
493 * Acquires a lock on the given region of this channel's file.
496 * region of this channel's file. The method behaves in exactly the same
530 * Acquires an exclusive lock on this channel's file.
533 * channel's file. The method returns a {@code Future} representing the
556 * Attempts to acquire a lock on the given region of this channel's file.
588 * region of the same file
605 * Attempts to acquire an exclusive lock on this channel's file.
640 * starting at the given file position.
643 * channel into the given buffer, starting at the given file position. The
645 * position is greater than or equal to the file's size at the time that the
650 * method, except that bytes are read starting at the given file position.
651 * If the given file position is greater than the file's size at the time
657 * The file position at which the transfer is to begin;
676 * starting at the given file position.
679 * channel into the given buffer, starting at the given file position. This
683 * than or equal to the file's size at the time that the read is attempted.
687 * read starting at the given file position. If the given file position is
688 * greater than the file's size at the time that the read is attempted then
694 * The file position at which the transfer is to begin;
708 * at the given file position.
712 * method, except that bytes are written starting at the given file position.
713 * If the given position is greater than the file's size, at the time that
714 * the write is attempted, then the file will be grown to accommodate the new
715 * bytes; the values of any bytes between the previous end-of-file and the
721 * The file position at which the transfer is to begin;
740 * at the given file position.
743 * channel from the given buffer, starting at the given file position. The
750 * written starting at the given file position. If the given position is
751 * greater than the file's size, at the time that the write is attempted,
752 * then the file will be grown to accommodate the new bytes; the values of
753 * any bytes between the previous end-of-file and the newly-written bytes
759 * The file position at which the transfer is to begin;