src/share/classes/java/io/RandomAccessFile.java

Print this page




 111      * @see        java.lang.SecurityManager#checkWrite(java.lang.String)
 112      * @revised 1.4
 113      * @spec JSR-51
 114      */
 115     public RandomAccessFile(String name, String mode)
 116         throws FileNotFoundException
 117     {
 118         this(name != null ? new File(name) : null, mode);
 119     }
 120 
 121     /**
 122      * Creates a random access file stream to read from, and optionally to
 123      * write to, the file specified by the {@link File} argument.  A new {@link
 124      * FileDescriptor} object is created to represent this file connection.
 125      *
 126      * <p>The <a name="mode"><tt>mode</tt></a> argument specifies the access mode
 127      * in which the file is to be opened.  The permitted values and their
 128      * meanings are:
 129      *
 130      * <table summary="Access mode permitted values and meanings">
 131      * <tr><th><p align="left">Value</p></th><th><p align="left">Meaning</p></th></tr>
 132      * <tr><td valign="top"><tt>"r"</tt></td>
 133      *     <td> Open for reading only.  Invoking any of the <tt>write</tt>
 134      *     methods of the resulting object will cause an {@link
 135      *     java.io.IOException} to be thrown. </td></tr>
 136      * <tr><td valign="top"><tt>"rw"</tt></td>
 137      *     <td> Open for reading and writing.  If the file does not already
 138      *     exist then an attempt will be made to create it. </td></tr>
 139      * <tr><td valign="top"><tt>"rws"</tt></td>
 140      *     <td> Open for reading and writing, as with <tt>"rw"</tt>, and also
 141      *     require that every update to the file's content or metadata be
 142      *     written synchronously to the underlying storage device.  </td></tr>
 143      * <tr><td valign="top"><tt>"rwd"&nbsp;&nbsp;</tt></td>
 144      *     <td> Open for reading and writing, as with <tt>"rw"</tt>, and also
 145      *     require that every update to the file's content be written
 146      *     synchronously to the underlying storage device. </td></tr>
 147      * </table>
 148      *
 149      * The <tt>"rws"</tt> and <tt>"rwd"</tt> modes work much like the {@link
 150      * java.nio.channels.FileChannel#force(boolean) force(boolean)} method of
 151      * the {@link java.nio.channels.FileChannel} class, passing arguments of




 111      * @see        java.lang.SecurityManager#checkWrite(java.lang.String)
 112      * @revised 1.4
 113      * @spec JSR-51
 114      */
 115     public RandomAccessFile(String name, String mode)
 116         throws FileNotFoundException
 117     {
 118         this(name != null ? new File(name) : null, mode);
 119     }
 120 
 121     /**
 122      * Creates a random access file stream to read from, and optionally to
 123      * write to, the file specified by the {@link File} argument.  A new {@link
 124      * FileDescriptor} object is created to represent this file connection.
 125      *
 126      * <p>The <a name="mode"><tt>mode</tt></a> argument specifies the access mode
 127      * in which the file is to be opened.  The permitted values and their
 128      * meanings are:
 129      *
 130      * <table summary="Access mode permitted values and meanings">
 131      * <tr><th align="left">Value</th><th align="left">Meaning</th></tr>
 132      * <tr><td valign="top"><tt>"r"</tt></td>
 133      *     <td> Open for reading only.  Invoking any of the <tt>write</tt>
 134      *     methods of the resulting object will cause an {@link
 135      *     java.io.IOException} to be thrown. </td></tr>
 136      * <tr><td valign="top"><tt>"rw"</tt></td>
 137      *     <td> Open for reading and writing.  If the file does not already
 138      *     exist then an attempt will be made to create it. </td></tr>
 139      * <tr><td valign="top"><tt>"rws"</tt></td>
 140      *     <td> Open for reading and writing, as with <tt>"rw"</tt>, and also
 141      *     require that every update to the file's content or metadata be
 142      *     written synchronously to the underlying storage device.  </td></tr>
 143      * <tr><td valign="top"><tt>"rwd"&nbsp;&nbsp;</tt></td>
 144      *     <td> Open for reading and writing, as with <tt>"rw"</tt>, and also
 145      *     require that every update to the file's content be written
 146      *     synchronously to the underlying storage device. </td></tr>
 147      * </table>
 148      *
 149      * The <tt>"rws"</tt> and <tt>"rwd"</tt> modes work much like the {@link
 150      * java.nio.channels.FileChannel#force(boolean) force(boolean)} method of
 151      * the {@link java.nio.channels.FileChannel} class, passing arguments of