Class FileRecoveryException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- ca.cgjennings.apps.arkham.component.FileRecoveryException
-
- All Implemented Interfaces:
java.io.Serializable
public class FileRecoveryException extends java.io.IOException
This is a special exception that may be thrown while a component is being read from a stream. It indicates that the file is corrupt or damaged in some way that it cannot be completely recovered, but that as much of the file as could be salvaged has been written to a new component that has been saved as a temporary file. This exception is caught byResourceKit.getGameComponentFromStream(java.io.InputStream, java.lang.String, boolean)
and it will automatically substitute the component from the supplied temporary file.- Author:
- Chris Jennings
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FileRecoveryException(java.io.File tempFileForRecovery, java.lang.String recoveryTitle, java.lang.String successMessage, java.lang.String failMessage)
Creates a new exception that allows recovery from the supplied temporary file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getFailureMessage()
java.lang.String
getSuccessMessage()
java.io.File
getTempFile()
Returns the file to use to replace the component that was being read when the exception was thrown.java.lang.String
getTitle()
-
-
-
Constructor Detail
-
FileRecoveryException
public FileRecoveryException(java.io.File tempFileForRecovery, java.lang.String recoveryTitle, java.lang.String successMessage, java.lang.String failMessage)
Creates a new exception that allows recovery from the supplied temporary file.- Parameters:
tempFileForRecovery
- the file to attempt recovery fromrecoveryTitle
- the title of a message that may be displayed to the user after recovery; if this isnull
, a default title will be usedsuccessMessage
- the body of a message that may be displayed to the user after recovery; if this isnull
, no message will be displayedfailMessage
- the body of a message that may be displayed to the user if recovery fails; if this isnull
, no message will be displayed
-
-
Method Detail
-
getTempFile
public java.io.File getTempFile()
Returns the file to use to replace the component that was being read when the exception was thrown.- Returns:
- a temporary file containing a serialized game component
-
getTitle
public java.lang.String getTitle()
-
getSuccessMessage
public java.lang.String getSuccessMessage()
-
getFailureMessage
public java.lang.String getFailureMessage()
-
-