01 /*
02 * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package java.awt.print;
27
28 import java.io.IOException;
29
30 /**
31 * The <code>PrinterIOException</code> class is a subclass of
32 * {@link PrinterException} and is used to indicate that an IO error
33 * of some sort has occurred while printing.
34 *
35 * <p>As of release 1.4, this exception has been retrofitted to conform to
36 * the general purpose exception-chaining mechanism. The
37 * "<code>IOException</code> that terminated the print job"
38 * that is provided at construction time and accessed via the
39 * {@link #getIOException()} method is now known as the <i>cause</i>,
40 * and may be accessed via the {@link Throwable#getCause()} method,
41 * as well as the aforementioned "legacy method."
42 */
43 public class PrinterIOException extends PrinterException {
44 static final long serialVersionUID = 5850870712125932846L;
45
46 /**
47 * The IO error that terminated the print job.
48 * @serial
49 */
50 private IOException mException;
51
52 /**
53 * Constructs a new <code>PrinterIOException</code>
54 * with the string representation of the specified
55 * {@link IOException}.
56 * @param exception the specified <code>IOException</code>
57 */
58 public PrinterIOException(IOException exception) {
59 initCause(null); // Disallow subsequent initCause
60 mException = exception;
61 }
62
63 /**
64 * Returns the <code>IOException</code> that terminated
65 * the print job.
66 *
67 * <p>This method predates the general-purpose exception chaining facility.
68 * The {@link Throwable#getCause()} method is now the preferred means of
69 * obtaining this information.
70 *
71 * @return the <code>IOException</code> that terminated
72 * the print job.
73 * @see IOException
74 */
75 public IOException getIOException() {
76 return mException;
77 }
78
79 /**
80 * Returns the the cause of this exception (the <code>IOException</code>
81 * that terminated the print job).
82 *
83 * @return the cause of this exception.
84 * @since 1.4
85 */
86 public Throwable getCause() {
87 return mException;
88 }
89 }
|