Showing the changes to java/pkg/java/awt/print/PrinterIOException.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,88 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package java.awt.print; | |
| 27 | +import java.io.IOException; | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * The <code>PrinterIOException</code> class is a subclass of | |
| 31 | + * {@link PrinterException} and is used to indicate that an IO error | |
| 32 | + * of some sort has occurred while printing. | |
| 33 | + * | |
| 34 | + * <p>As of release 1.4, this exception has been retrofitted to conform to | |
| 35 | + * the general purpose exception-chaining mechanism. The | |
| 36 | + * "<code>IOException</code> that terminated the print job" | |
| 37 | + * that is provided at construction time and accessed via the | |
| 38 | + * {@link #getIOException()} method is now known as the <i>cause</i>, | |
| 39 | + * and may be accessed via the {@link Throwable#getCause()} method, | |
| 40 | + * as well as the aforementioned "legacy method." | |
| 41 | + */ | |
| 42 | +public class PrinterIOException extends PrinterException { | |
| 43 | + static final long serialVersionUID = 5850870712125932846L; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * The IO error that terminated the print job. | |
| 47 | + * @serial | |
| 48 | + */ | |
| 49 | + private IOException mException; | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * Constructs a new <code>PrinterIOException</code> | |
| 53 | + * with the string representation of the specified | |
| 54 | + * {@link IOException}. | |
| 55 | + * @param exception the specified <code>IOException</code> | |
| 56 | + */ | |
| 57 | + public PrinterIOException(IOException exception) { | |
| 58 | + initCause(null); // Disallow subsequent initCause | |
| 59 | + mException = exception; | |
| 60 | + } | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Returns the <code>IOException</code> that terminated | |
| 64 | + * the print job. | |
| 65 | + * | |
| 66 | + * <p>This method predates the general-purpose exception chaining facility. | |
| 67 | + * The {@link Throwable#getCause()} method is now the preferred means of | |
| 68 | + * obtaining this information. | |
| 69 | + * | |
| 70 | + * @return the <code>IOException</code> that terminated | |
| 71 | + * the print job. | |
| 72 | + * @see IOException | |
| 73 | + */ | |
| 74 | + public IOException getIOException() { | |
| 75 | + return mException; | |
| 76 | + } | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * Returns the the cause of this exception (the <code>IOException</code> | |
| 80 | + * that terminated the print job). | |
| 81 | + * | |
| 82 | + * @return the cause of this exception. | |
| 83 | + * @since 1.4 | |
| 84 | + */ | |
| 85 | + public Throwable getCause() { | |
| 86 | + return mException; | |
| 87 | + } | |
| 88 | +} | |