uk.org.blankaspect.nlf
Class NlfException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by uk.org.blankaspect.nlf.NlfException
All Implemented Interfaces:
java.io.Serializable

public class NlfException
extends java.lang.Exception

An object of this class signals that an exception has occurred during an operation on a Nested List File. An exception has an identifier that maps to a detail message, and may include the file on which the exception occurred and the offset within the file at which it occurred. The exception may also act as a wrapper for another java.lang.Throwable, which is known as the cause.

The file, offset and cause are not automatically incorporated into the detail message of an NlfException, but they can be obtained, along with the exception identifier, by methods of this class or a superclass.

Since:
1.0
See Also:
NlfUncheckedException, Serialized Form

Constructor Summary
NlfException(ExceptionId id)
          Constructs an NlfException with the specified identifier.
NlfException(ExceptionId id, java.io.File file)
          Constructs an NlfException with the specified identifier and file.
NlfException(ExceptionId id, java.io.File file, long offset)
          Constructs an NlfException with the specified identifier, file and offset.
NlfException(ExceptionId id, java.io.File file, long offset, java.lang.Throwable cause)
          Constructs an NlfException with the specified identifier, file, offset and cause.
NlfException(ExceptionId id, java.io.File file, java.lang.Throwable cause)
          Constructs an NlfException with the specified identifier, file and cause.
NlfException(ExceptionId id, java.lang.Throwable cause)
          Constructs an NlfException with the specified identifier and cause.
 
Method Summary
 java.io.File getFile()
          Returns the file that is associated with the exception.
 ExceptionId getId()
          Returns the exception identifier.
 long getOffset()
          Returns the offset that is associated with the exception, or -1 if the offset is not set to a legal value.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, 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

NlfException

public NlfException(ExceptionId id)
Constructs an NlfException with the specified identifier. The identifier maps to a message that is used as the exception's detail message in the constructor of java.lang.Exception.

Parameters:
id - the exception identifier.
Since:
1.0

NlfException

public NlfException(ExceptionId id,
                    java.lang.Throwable cause)
Constructs an NlfException with the specified identifier and cause. The identifier maps to a message that is used as the exception's detail message in the constructor of java.lang.Exception.

Parameters:
id - the exception identifier.
cause - the java.lang.Throwable that caused this exception.
Since:
1.0

NlfException

public NlfException(ExceptionId id,
                    java.io.File file)
Constructs an NlfException with the specified identifier and file. The identifier maps to a message that is used as the exception's detail message in the constructor of java.lang.Exception.

Parameters:
id - the exception identifier.
file - the file that is associated with the exception, usually the file on which the exception occurred.
Since:
1.0

NlfException

public NlfException(ExceptionId id,
                    java.io.File file,
                    java.lang.Throwable cause)
Constructs an NlfException with the specified identifier, file and cause. The identifier maps to a message that is used as the exception's detail message in the constructor of java.lang.Exception.

Parameters:
id - the exception identifier.
file - the file that is associated with the exception, usually the file on which the exception occurred.
cause - the java.lang.Throwable that caused this exception.
Since:
1.0

NlfException

public NlfException(ExceptionId id,
                    java.io.File file,
                    long offset)
Constructs an NlfException with the specified identifier, file and offset. The identifier maps to a message that is used as the exception's detail message in the constructor of java.lang.Exception.

Parameters:
id - the exception identifier.
file - the file that is associated with the exception, usually the file on which the exception occurred.
offset - the offset that is associated with the exception, usually the offset to file at which the exception occurred.
Since:
1.0

NlfException

public NlfException(ExceptionId id,
                    java.io.File file,
                    long offset,
                    java.lang.Throwable cause)
Constructs an NlfException with the specified identifier, file, offset and cause. The identifier maps to a message that is used as the exception's detail message in the constructor of java.lang.Exception.

Parameters:
id - the exception identifier.
file - the file that is associated with the exception, usually the file on which the exception occurred.
offset - the offset that is associated with the exception, usually the offset to file at which the exception occurred.
cause - the java.lang.Throwable that caused this exception.
Since:
1.0
Method Detail

getId

public ExceptionId getId()
Returns the exception identifier.

Returns:
the exception identifier.
Since:
1.0

getFile

public java.io.File getFile()
Returns the file that is associated with the exception. The file will usually be the file on which the exception occurred.

Returns:
the file that is associated with the exception. A null value indicates that no file is associated with the exception.
Since:
1.0
See Also:
getOffset()

getOffset

public long getOffset()
Returns the offset that is associated with the exception, or -1 if the offset is not set to a legal value. The offset will usually be an offset to the file returned by getFile() at which the exception occurred.

Returns:
the offset that is associated with the exception. A value of -1 indicates that the offset has not been set, or that it was set to an illegal value.
Since:
1.0
See Also:
getFile()