sears.file.exception.io
Class FileConversionException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.io.IOException
              extended by sears.file.exception.io.FileConversionException
All Implemented Interfaces:
java.io.Serializable

public abstract class FileConversionException
extends java.io.IOException

A FileConversionException is throw when an error occurs during a file access and conversion to subtitle file
This class provides static methods to create generic objects using the class constants.

Two distinct categories of constants:
- file access exception ( read and write access )
- malformed subtitle file exception

See Also:
Serialized Form

Field Summary
static int EMPTY_SUBTITLE_FILE
          MALFORMED SUBTITLE FILE EXCEPTION: empty subtitle file exception
static int MALFORMED_END_TIME
          MALFORMED SUBTITLE FILE EXCEPTION: malformed subtitle end time exception
static int MALFORMED_START_TIME
          MALFORMED SUBTITLE FILE EXCEPTION: malformed subtitle start time exception
static int MALFORMED_SUBTITLE_FILE
          MALFORMED SUBTITLE FILE EXCEPTION: generic subtitle file exception
static int MALFORMED_SUBTITLE_NUMBER
          MALFORMED SUBTITLE FILE EXCEPTION: malformed subtitle number exception
static int MALFORMED_SUBTITLE_TEXT
          MALFORMED SUBTITLE FILE EXCEPTION: malformed subtitle text exception
static int MALFORMED_TIME_LINE
          MALFORMED SUBTITLE FILE EXCEPTION: malformed subtitle time line exception
static int NO_SUBTITLE_NUMBER
          MALFORMED SUBTITLE FILE EXCEPTION: no subtitle number exception
static int NO_SUBTITLE_TEXT
          MALFORMED SUBTITLE FILE EXCEPTION: no subtitle text exception
static int NO_SUBTITLE_TIME
          MALFORMED SUBTITLE FILE EXCEPTION: no subtitle time exception
static int READ_ACCESS
          FILE ACCESS EXCEPTION: Read access exception
static int UNEXPECTED_END_OF_FILE
          MALFORMED SUBTITLE FILE EXCEPTION: unexpected end of file exception
static int UNSUPPORTED_FILE_SIZE
          FILE ACCESS EXCEPTION: unsupported file size exception
static int WRITE_ACCESS
          FILE ACCESS EXCEPTION: Write access exception
 
Constructor Summary
FileConversionException()
           
 
Method Summary
abstract  boolean couldBeABadEncoding()
          Returns a boolean which indicates if the error could have appeared because of a bad encoding/decoding
static FileConversionException getAccessException(int type, java.io.File file)
          Get a new FileConversionException instance
abstract  java.lang.String getDetail()
          Returns the detail error message
static FileConversionException getMalformedSubtitleFileException(int type, java.io.File file)
          Get a new FileConversionException instance
static FileConversionException getMalformedSubtitleFileException(int type, java.io.File file, int lineNumber, java.lang.String line)
          Get a new FileConversionException instance
abstract  java.lang.String getMessage()
          Returns the error message
static FileConversionException getUnsupportedFileFormatException(java.io.File file, java.lang.String extension)
          Get a new FileConversionException instance
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

READ_ACCESS

public static final int READ_ACCESS
FILE ACCESS EXCEPTION: Read access exception

See Also:
Constant Field Values

WRITE_ACCESS

public static final int WRITE_ACCESS
FILE ACCESS EXCEPTION: Write access exception

See Also:
Constant Field Values

UNSUPPORTED_FILE_SIZE

public static final int UNSUPPORTED_FILE_SIZE
FILE ACCESS EXCEPTION: unsupported file size exception

See Also:
Constant Field Values

NO_SUBTITLE_NUMBER

public static final int NO_SUBTITLE_NUMBER
MALFORMED SUBTITLE FILE EXCEPTION: no subtitle number exception

See Also:
Constant Field Values

MALFORMED_SUBTITLE_NUMBER

public static final int MALFORMED_SUBTITLE_NUMBER
MALFORMED SUBTITLE FILE EXCEPTION: malformed subtitle number exception

See Also:
Constant Field Values

NO_SUBTITLE_TIME

public static final int NO_SUBTITLE_TIME
MALFORMED SUBTITLE FILE EXCEPTION: no subtitle time exception

See Also:
Constant Field Values

MALFORMED_TIME_LINE

public static final int MALFORMED_TIME_LINE
MALFORMED SUBTITLE FILE EXCEPTION: malformed subtitle time line exception

See Also:
Constant Field Values

MALFORMED_START_TIME

public static final int MALFORMED_START_TIME
MALFORMED SUBTITLE FILE EXCEPTION: malformed subtitle start time exception

See Also:
Constant Field Values

MALFORMED_END_TIME

public static final int MALFORMED_END_TIME
MALFORMED SUBTITLE FILE EXCEPTION: malformed subtitle end time exception

See Also:
Constant Field Values

NO_SUBTITLE_TEXT

public static final int NO_SUBTITLE_TEXT
MALFORMED SUBTITLE FILE EXCEPTION: no subtitle text exception

See Also:
Constant Field Values

MALFORMED_SUBTITLE_TEXT

public static final int MALFORMED_SUBTITLE_TEXT
MALFORMED SUBTITLE FILE EXCEPTION: malformed subtitle text exception

See Also:
Constant Field Values

MALFORMED_SUBTITLE_FILE

public static final int MALFORMED_SUBTITLE_FILE
MALFORMED SUBTITLE FILE EXCEPTION: generic subtitle file exception

See Also:
Constant Field Values

UNEXPECTED_END_OF_FILE

public static final int UNEXPECTED_END_OF_FILE
MALFORMED SUBTITLE FILE EXCEPTION: unexpected end of file exception

See Also:
Constant Field Values

EMPTY_SUBTITLE_FILE

public static final int EMPTY_SUBTITLE_FILE
MALFORMED SUBTITLE FILE EXCEPTION: empty subtitle file exception

See Also:
Constant Field Values
Constructor Detail

FileConversionException

public FileConversionException()
Method Detail

getMessage

public abstract java.lang.String getMessage()
Returns the error message

Overrides:
getMessage in class java.lang.Throwable
Returns:
the error message

getDetail

public abstract java.lang.String getDetail()
Returns the detail error message

Returns:
the detail error message

couldBeABadEncoding

public abstract boolean couldBeABadEncoding()
Returns a boolean which indicates if the error could have appeared because of a bad encoding/decoding

Returns:
true if the error could be appear because a bad encoding/decoding false if not

getAccessException

public static FileConversionException getAccessException(int type,
                                                         java.io.File file)
Get a new FileConversionException instance

Parameters:
type - READ_ACCESS, WRITE_ACCESS, UNSUPPORTED_FILE_SIZE
file - the file where the error is encountered
Returns:
a new read access exception

getMalformedSubtitleFileException

public static FileConversionException getMalformedSubtitleFileException(int type,
                                                                        java.io.File file)
Get a new FileConversionException instance

Parameters:
type - UNEXPECTED_END_OF_FILE, EMPTY_SUBTITLE_FILE
file - the file on which the error occurs
Returns:
a new malformed subtitle file exception

getMalformedSubtitleFileException

public static FileConversionException getMalformedSubtitleFileException(int type,
                                                                        java.io.File file,
                                                                        int lineNumber,
                                                                        java.lang.String line)
Get a new FileConversionException instance

Parameters:
type - MALFORMED_SUBTITLE_NUMBER
NO_SUBTITLE_TIME
MALFORMED_TIME_LINE
MALFORMED_START_TIME
MALFORMED_END_TIME
NO_SUBTITLE_TEXT
MALFORMED_SUBTITLE_TEXT
MALFORMED_SUBTITLE_FILE
file - the file on which the error occurrs
lineNumber - the line number where the error is encountered
line - the line where the error is encountered
Returns:
a new FileConversionException instance

getUnsupportedFileFormatException

public static FileConversionException getUnsupportedFileFormatException(java.io.File file,
                                                                        java.lang.String extension)
Get a new FileConversionException instance

Parameters:
file - the file in cause
extension - the file extension
Returns:
a unsupported file format exception