< prev index next >

src/java.base/share/classes/java/io/FileNotFoundException.java

Print this page




  24  */
  25 
  26 package java.io;
  27 
  28 
  29 /**
  30  * Signals that an attempt to open the file denoted by a specified pathname
  31  * has failed.
  32  *
  33  * <p> This exception will be thrown by the {@link FileInputStream}, {@link
  34  * FileOutputStream}, and {@link RandomAccessFile} constructors when a file
  35  * with the specified pathname does not exist.  It will also be thrown by these
  36  * constructors if the file does exist but for some reason is inaccessible, for
  37  * example when an attempt is made to open a read-only file for writing.
  38  *
  39  * @author  unascribed
  40  * @since   1.0
  41  */
  42 
  43 public class FileNotFoundException extends IOException {

  44     private static final long serialVersionUID = -897856973823710492L;
  45 
  46     /**
  47      * Constructs a <code>FileNotFoundException</code> with
  48      * <code>null</code> as its error detail message.
  49      */
  50     public FileNotFoundException() {
  51         super();
  52     }
  53 
  54     /**
  55      * Constructs a <code>FileNotFoundException</code> with the
  56      * specified detail message. The string <code>s</code> can be
  57      * retrieved later by the
  58      * <code>{@link java.lang.Throwable#getMessage}</code>
  59      * method of class <code>java.lang.Throwable</code>.
  60      *
  61      * @param   s   the detail message.
  62      */
  63     public FileNotFoundException(String s) {


  24  */
  25 
  26 package java.io;
  27 
  28 
  29 /**
  30  * Signals that an attempt to open the file denoted by a specified pathname
  31  * has failed.
  32  *
  33  * <p> This exception will be thrown by the {@link FileInputStream}, {@link
  34  * FileOutputStream}, and {@link RandomAccessFile} constructors when a file
  35  * with the specified pathname does not exist.  It will also be thrown by these
  36  * constructors if the file does exist but for some reason is inaccessible, for
  37  * example when an attempt is made to open a read-only file for writing.
  38  *
  39  * @author  unascribed
  40  * @since   1.0
  41  */
  42 
  43 public class FileNotFoundException extends IOException {
  44     @java.io.Serial
  45     private static final long serialVersionUID = -897856973823710492L;
  46 
  47     /**
  48      * Constructs a <code>FileNotFoundException</code> with
  49      * <code>null</code> as its error detail message.
  50      */
  51     public FileNotFoundException() {
  52         super();
  53     }
  54 
  55     /**
  56      * Constructs a <code>FileNotFoundException</code> with the
  57      * specified detail message. The string <code>s</code> can be
  58      * retrieved later by the
  59      * <code>{@link java.lang.Throwable#getMessage}</code>
  60      * method of class <code>java.lang.Throwable</code>.
  61      *
  62      * @param   s   the detail message.
  63      */
  64     public FileNotFoundException(String s) {
< prev index next >