KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > print > PrinterIOException


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
8 package java.awt.print;
9 import java.io.IOException JavaDoc;
10
11 /**
12  * The <code>PrinterIOException</code> class is a subclass of
13  * {@link PrinterException} and is used to indicate that an IO error
14  * of some sort has occurred while printing.
15  *
16  * <p>As of release 1.4, this exception has been retrofitted to conform to
17  * the general purpose exception-chaining mechanism. The
18  * "<code>IOException</code> that terminated the print job"
19  * that is provided at construction time and accessed via the
20  * {@link #getIOException()} method is now known as the <i>cause</i>,
21  * and may be accessed via the {@link Throwable#getCause()} method,
22  * as well as the aforementioned "legacy method."
23  */

24 public class PrinterIOException extends PrinterException JavaDoc {
25     static final long serialVersionUID = 5850870712125932846L;
26
27     /**
28      * The IO error that terminated the print job.
29      * @serial
30      */

31     private IOException JavaDoc mException;
32
33     /**
34      * Constructs a new <code>PrinterIOException</code>
35      * with the string representation of the specified
36      * {@link IOException}.
37      * @param exception the specified <code>IOException</code>
38      */

39     public PrinterIOException(IOException JavaDoc exception) {
40         initCause(null); // Disallow subsequent initCause
41
mException = exception;
42     }
43
44     /**
45      * Returns the <code>IOException</code> that terminated
46      * the print job.
47      *
48      * <p>This method predates the general-purpose exception chaining facility.
49      * The {@link Throwable#getCause()} method is now the preferred means of
50      * obtaining this information.
51      *
52      * @return the <code>IOException</code> that terminated
53      * the print job.
54      * @see IOException
55      */

56     public IOException JavaDoc getIOException() {
57         return mException;
58     }
59
60     /**
61      * Returns the the cause of this exception (the <code>IOException</code>
62      * that terminated the print job).
63      *
64      * @return the cause of this exception.
65      * @since 1.4
66      */

67     public Throwable JavaDoc getCause() {
68         return mException;
69     }
70 }
71
Popular Tags