1. /*
  2. * @(#)PrinterIOException.java 1.17 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt.print;
  8. import java.io.IOException;
  9. /**
  10. * The <code>PrinterIOException</code> class is a subclass of
  11. * {@link PrinterException} and is used to indicate that an IO error
  12. * of some sort has occurred while printing.
  13. *
  14. * <p>As of release 1.4, this exception has been retrofitted to conform to
  15. * the general purpose exception-chaining mechanism. The
  16. * "<code>IOException</code> that terminated the print job"
  17. * that is provided at construction time and accessed via the
  18. * {@link #getIOException()} method is now known as the <i>cause</i>,
  19. * and may be accessed via the {@link Throwable#getCause()} method,
  20. * as well as the aforementioned "legacy method."
  21. */
  22. public class PrinterIOException extends PrinterException {
  23. static final long serialVersionUID = 5850870712125932846L;
  24. /**
  25. * The IO error that terminated the print job.
  26. * @serial
  27. */
  28. private IOException mException;
  29. /**
  30. * Constructs a new <code>PrinterIOException</code>
  31. * with the string representation of the specified
  32. * {@link IOException}.
  33. * @param exception the specified <code>IOException</code>
  34. */
  35. public PrinterIOException(IOException exception) {
  36. initCause(null); // Disallow subsequent initCause
  37. mException = exception;
  38. }
  39. /**
  40. * Returns the <code>IOException</code> that terminated
  41. * the print job.
  42. *
  43. * <p>This method predates the general-purpose exception chaining facility.
  44. * The {@link Throwable#getCause()} method is now the preferred means of
  45. * obtaining this information.
  46. *
  47. * @return the <code>IOException</code> that terminated
  48. * the print job.
  49. * @see IOException
  50. */
  51. public IOException getIOException() {
  52. return mException;
  53. }
  54. /**
  55. * Returns the the cause of this exception (the <code>IOException</code>
  56. * that terminated the print job).
  57. *
  58. * @return the cause of this exception.
  59. * @since 1.4
  60. */
  61. public Throwable getCause() {
  62. return mException;
  63. }
  64. }