119 */ 120 protected AsynchronousFileChannel() { 121 } 122 123 /** 124 * Opens or creates a file for reading and/or writing, returning an 125 * asynchronous file channel to access the file. 126 * 127 * <p> The {@code options} parameter determines how the file is opened. 128 * The {@link StandardOpenOption#READ READ} and {@link StandardOpenOption#WRITE 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 131 * is opened for reading. 132 * 133 * <p> In addition to {@code READ} and {@code WRITE}, the following options 134 * may be present: 135 * 136 * <table class="striped"> 137 * <caption style="display:none">additional options</caption> 138 * <thead> 139 * <tr> <th>Option</th> <th>Description</th> </tr> 140 * </thead> 141 * <tbody> 142 * <tr> 143 * <td> {@link StandardOpenOption#TRUNCATE_EXISTING TRUNCATE_EXISTING} </td> 144 * <td> When opening an existing file, the file is first truncated to a 145 * size of 0 bytes. This option is ignored when the file is opened only 146 * for reading.</td> 147 * </tr> 148 * <tr> 149 * <td> {@link StandardOpenOption#CREATE_NEW CREATE_NEW} </td> 150 * <td> If this option is present then a new file is created, failing if 151 * the file already exists. When creating a file the check for the 152 * existence of the file and the creation of the file if it does not exist 153 * is atomic with respect to other file system operations. This option is 154 * ignored when the file is opened only for reading. </td> 155 * </tr> 156 * <tr> 157 * <td > {@link StandardOpenOption#CREATE CREATE} </td> 158 * <td> If this option is present then an existing file is opened if it 159 * exists, otherwise a new file is created. When creating a file the check 160 * for the existence of the file and the creation of the file if it does 161 * not exist is atomic with respect to other file system operations. This 162 * option is ignored if the {@code CREATE_NEW} option is also present or 163 * the file is opened only for reading. </td> 164 * </tr> 165 * <tr> 166 * <td > {@link StandardOpenOption#DELETE_ON_CLOSE DELETE_ON_CLOSE} </td> 167 * <td> When this option is present then the implementation makes a 168 * <em>best effort</em> attempt to delete the file when closed by the 169 * the {@link #close close} method. If the {@code close} method is not 170 * invoked then a <em>best effort</em> attempt is made to delete the file 171 * when the Java virtual machine terminates. </td> 172 * </tr> 173 * <tr> 174 * <td>{@link StandardOpenOption#SPARSE SPARSE} </td> 175 * <td> When creating a new file this option is a <em>hint</em> that the 176 * new file will be sparse. This option is ignored when not creating 177 * a new file. </td> 178 * </tr> 179 * <tr> 180 * <td> {@link StandardOpenOption#SYNC SYNC} </td> 181 * <td> Requires that every update to the file's content or metadata be 182 * written synchronously to the underlying storage device. (see <a 183 * href="../file/package-summary.html#integrity"> Synchronized I/O file 184 * integrity</a>). </td> 185 * </tr> 186 * <tr> 187 * <td> {@link StandardOpenOption#DSYNC DSYNC} </td> 188 * <td> Requires that every update to the file's content be written 189 * synchronously to the underlying storage device. (see <a 190 * href="../file/package-summary.html#integrity"> Synchronized I/O file 191 * integrity</a>). </td> 192 * </tr> 193 * </tbody> 194 * </table> 195 * 196 * <p> An implementation may also support additional options. 197 * 198 * <p> The {@code executor} parameter is the {@link ExecutorService} to 199 * which tasks are submitted to handle I/O events and dispatch completion 200 * results for operations initiated on resulting channel. 201 * The nature of these tasks is highly implementation specific and so care 202 * should be taken when configuring the {@code Executor}. Minimally it 203 * should support an unbounded work queue and should not run tasks on the 204 * caller thread of the {@link ExecutorService#execute execute} method. 205 * Shutting down the executor service while the channel is open results in 206 * unspecified behavior. 207 * | 119 */ 120 protected AsynchronousFileChannel() { 121 } 122 123 /** 124 * Opens or creates a file for reading and/or writing, returning an 125 * asynchronous file channel to access the file. 126 * 127 * <p> The {@code options} parameter determines how the file is opened. 128 * The {@link StandardOpenOption#READ READ} and {@link StandardOpenOption#WRITE 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 131 * is opened for reading. 132 * 133 * <p> In addition to {@code READ} and {@code WRITE}, the following options 134 * may be present: 135 * 136 * <table class="striped"> 137 * <caption style="display:none">additional options</caption> 138 * <thead> 139 * <tr> <th scope="col">Option</th> <th scope="col">Description</th> </tr> 140 * </thead> 141 * <tbody> 142 * <tr> 143 * <th scope="row"> {@link StandardOpenOption#TRUNCATE_EXISTING TRUNCATE_EXISTING} </th> 144 * <td> When opening an existing file, the file is first truncated to a 145 * size of 0 bytes. This option is ignored when the file is opened only 146 * for reading.</td> 147 * </tr> 148 * <tr> 149 * <th scope="row"> {@link StandardOpenOption#CREATE_NEW CREATE_NEW} </th> 150 * <td> If this option is present then a new file is created, failing if 151 * the file already exists. When creating a file the check for the 152 * existence of the file and the creation of the file if it does not exist 153 * is atomic with respect to other file system operations. This option is 154 * ignored when the file is opened only for reading. </td> 155 * </tr> 156 * <tr> 157 * <th scope="row" > {@link StandardOpenOption#CREATE CREATE} </th> 158 * <td> If this option is present then an existing file is opened if it 159 * exists, otherwise a new file is created. When creating a file the check 160 * for the existence of the file and the creation of the file if it does 161 * not exist is atomic with respect to other file system operations. This 162 * option is ignored if the {@code CREATE_NEW} option is also present or 163 * the file is opened only for reading. </td> 164 * </tr> 165 * <tr> 166 * <th scope="row" > {@link StandardOpenOption#DELETE_ON_CLOSE DELETE_ON_CLOSE} </th> 167 * <td> When this option is present then the implementation makes a 168 * <em>best effort</em> attempt to delete the file when closed by the 169 * the {@link #close close} method. If the {@code close} method is not 170 * invoked then a <em>best effort</em> attempt is made to delete the file 171 * when the Java virtual machine terminates. </td> 172 * </tr> 173 * <tr> 174 * <th scope="row">{@link StandardOpenOption#SPARSE SPARSE} </th> 175 * <td> When creating a new file this option is a <em>hint</em> that the 176 * new file will be sparse. This option is ignored when not creating 177 * a new file. </td> 178 * </tr> 179 * <tr> 180 * <th scope="row"> {@link StandardOpenOption#SYNC SYNC} </th> 181 * <td> Requires that every update to the file's content or metadata be 182 * written synchronously to the underlying storage device. (see <a 183 * href="../file/package-summary.html#integrity"> Synchronized I/O file 184 * integrity</a>). </td> 185 * </tr> 186 * <tr> 187 * <th scope="row"> {@link StandardOpenOption#DSYNC DSYNC} </th> 188 * <td> Requires that every update to the file's content be written 189 * synchronously to the underlying storage device. (see <a 190 * href="../file/package-summary.html#integrity"> Synchronized I/O file 191 * integrity</a>). </td> 192 * </tr> 193 * </tbody> 194 * </table> 195 * 196 * <p> An implementation may also support additional options. 197 * 198 * <p> The {@code executor} parameter is the {@link ExecutorService} to 199 * which tasks are submitted to handle I/O events and dispatch completion 200 * results for operations initiated on resulting channel. 201 * The nature of these tasks is highly implementation specific and so care 202 * should be taken when configuring the {@code Executor}. Minimally it 203 * should support an unbounded work queue and should not run tasks on the 204 * caller thread of the {@link ExecutorService#execute execute} method. 205 * Shutting down the executor service while the channel is open results in 206 * unspecified behavior. 207 * |