1. /*
  2. * @(#)FileNotFoundException.java 1.22 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.io;
  8. /**
  9. * Signals that an attempt to open the file denoted by a specified pathname
  10. * has failed.
  11. *
  12. * <p> This exception will be thrown by the {@link FileInputStream}, {@link
  13. * FileOutputStream}, and {@link RandomAccessFile} constructors when a file
  14. * with the specified pathname does not exist. It will also be thrown by these
  15. * constructors if the file does exist but for some reason is inaccessible, for
  16. * example when an attempt is made to open a read-only file for writing.
  17. *
  18. * @author unascribed
  19. * @version 1.22, 01/23/03
  20. * @since JDK1.0
  21. */
  22. public class FileNotFoundException extends IOException {
  23. /**
  24. * Constructs a <code>FileNotFoundException</code> with
  25. * <code>null</code> as its error detail message.
  26. */
  27. public FileNotFoundException() {
  28. super();
  29. }
  30. /**
  31. * Constructs a <code>FileNotFoundException</code> with the
  32. * specified detail message. The string <code>s</code> can be
  33. * retrieved later by the
  34. * <code>{@link java.lang.Throwable#getMessage}</code>
  35. * method of class <code>java.lang.Throwable</code>.
  36. *
  37. * @param s the detail message.
  38. */
  39. public FileNotFoundException(String s) {
  40. super(s);
  41. }
  42. /**
  43. * Constructs a <code>FileNotFoundException</code> with a detail message
  44. * consisting of the given pathname string followed by the given reason
  45. * string. If the <code>reason</code> argument is <code>null</code> then
  46. * it will be omitted. This private constructor is invoked only by native
  47. * I/O methods.
  48. *
  49. * @since 1.2
  50. */
  51. private FileNotFoundException(String path, String reason) {
  52. super(path + ((reason == null)
  53. ? ""
  54. : " (" + reason + ")"));
  55. }
  56. }