KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > schlichtherle > io > archive > spi > TransientIOException


1 /*
2  * UncacheableIOException.java
3  *
4  * Created on 19. November 2006, 19:48
5  */

6
7 package de.schlichtherle.io.archive.spi;
8
9 import de.schlichtherle.io.File;
10
11 import java.io.IOException JavaDoc;
12
13 /**
14  * May be thrown by archive drivers to indicate that an {@link IOException}
15  * occured as a transient event when accessing an archive file and another
16  * try to access the same archive file may finally succeed.
17  * On the other hand, if the archive controller catches an IOException from
18  * an an archive driver when trying to access an archive file which is
19  * <em>not</em> a <code>TransientIOException</code>, then the archive
20  * controller may consider the archive file to be a false positive and cache
21  * the exception until {@link File#umount} or {@link File#update} is called.
22  * <p>
23  * This feature is primarily used by the RAES encrypted ZIP file driver
24  * family when prompting for passwords has been cancelled by the user.
25  * In this case, the driver will wrap the <code>IOException</code> in a
26  * <code>TransientIOException</code> and throw this instead to signal that
27  * another attempt to prompt the user should be allowed.
28  * <p>
29  * This class is marked final since the archive controller will throw
30  * away this exception anyway and deal with the transient cause only.
31  *
32  * @author Christian Schlichtherle
33  * @version @version@
34  * @since TrueZIP 6.4
35  */

36 public final class TransientIOException extends IOException JavaDoc {
37
38     /**
39      * @param cause The transient cause of this exception.
40      * @throws NullPointerException If <code>cause</code> is <code>null</code>.
41      */

42     public TransientIOException(IOException JavaDoc cause) {
43         if (cause == null)
44             throw new NullPointerException JavaDoc();
45         initCause(cause);
46     }
47
48     /**
49      * Returns the transient cause of this exception as an
50      * <code>IOException</code> - <code>null</code> is never returned.
51      */

52     public IOException JavaDoc getTransientCause() {
53         return (IOException JavaDoc) getCause();
54     }
55 }
56
Popular Tags