Class 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 by ResourceKit.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()  
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 from
        recoveryTitle - the title of a message that may be displayed to the user after recovery; if this is null, a default title will be used
        successMessage - the body of a message that may be displayed to the user after recovery; if this is null, no message will be displayed
        failMessage - the body of a message that may be displayed to the user if recovery fails; if this is null, 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()