sears.file
Class SrtFile

java.lang.Object
  extended by sears.file.SubtitleFile
      extended by sears.file.SrtFile

public class SrtFile
extends SubtitleFile

Class SrtFile.
Summary:
This class represent a srt subtitle file. Specialize the SubtitleFile for srt type subtitles.


Field Summary
protected static java.lang.String TIME_PATTERN
           
protected static java.lang.String TIME_SEPARATOR
           
protected static java.lang.String TOKEN_TIME_DELIMITER
           
 
Fields inherited from class sears.file.SubtitleFile
BASIC_CHARSETS, DEFAULT_CHARSET, file, fileChanged, subtitleList, temporaryFile
 
Constructor Summary
SrtFile()
          Constructor SrtFile.
SrtFile(java.io.File file, java.util.ArrayList<Subtitle> subtitleList)
          Constructor SrtFile.
SrtFile(java.io.File file, java.util.ArrayList<Subtitle> subtitleList, java.lang.String charset)
           
SrtFile(java.lang.String file, java.util.ArrayList<Subtitle> subtitleList)
          Constructor SrtFile.
 
Method Summary
 java.lang.String extension()
          Returns the extension file
protected  SubtitleFile getNewInstance()
          Method getNewInstance.
protected  void parse()
          Method parse.
 void writeToFile(java.io.File fileToWrite)
          Method writeToFile.
 void writeToTemporaryFile()
          Method writeToTemporaryFile.
 
Methods inherited from class sears.file.SubtitleFile
accentRepair, addFakeSub, addSubtitle, addSubtitle, append, delay, delay, delay, fileChanged, getANonNullCharset, getCharset, getContentDirectory, getFile, getInstance, getInstance, getInstance, getLineSeparator, getSubtitleAtDate, getSubtitleList, getSubtitleListClone, getSubtitles, getTemporaryFile, htmlRepair, isFileChanged, magicResynchro, mixWithAnotherSubtitleFile, normalizeDuration, normalizeDuration, orderRepair, resynchro, setCharset, setFile, setSubtitleList, shiftToZero, split, stringToTime, timeRepair, timeToString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIME_SEPARATOR

protected static final java.lang.String TIME_SEPARATOR
See Also:
Constant Field Values

TOKEN_TIME_DELIMITER

protected static final java.lang.String TOKEN_TIME_DELIMITER
See Also:
Constant Field Values

TIME_PATTERN

protected static final java.lang.String TIME_PATTERN
See Also:
Constant Field Values
Constructor Detail

SrtFile

public SrtFile()
Constructor SrtFile.
Summary:
Constructor of the class. Beware not to use this file directly, because it does contains no ST. You will have to fill the list of ST, and save the File first.


SrtFile

public SrtFile(java.io.File file,
               java.util.ArrayList<Subtitle> subtitleList)
        throws FileConversionException
Constructor SrtFile.
Summary:
Constructor of the class.

Parameters:
file - The (File) to open.
subtitleList - The (ArrayList) List of subtitles.
Throws:
java.io.IOException
MalformedSubtitleFileException
FileConversionException

SrtFile

public SrtFile(java.lang.String file,
               java.util.ArrayList<Subtitle> subtitleList)
        throws FileConversionException
Constructor SrtFile.
Summary:
Constructor of the class.

Parameters:
file - The (String) path to file to open.
subtitleList - The (ArrayList) List of subtitles.
Throws:
java.io.IOException
MalformedSubtitleFileException
FileConversionException

SrtFile

public SrtFile(java.io.File file,
               java.util.ArrayList<Subtitle> subtitleList,
               java.lang.String charset)
        throws FileConversionException
Throws:
FileConversionException
Method Detail

parse

protected void parse()
              throws FileConversionException
Description copied from class: SubtitleFile
Method parse.
Summary:
This method parse the current file, and construct the subtitleList.

Specified by:
parse in class SubtitleFile
Throws:
FileConversionException - if a limitation when reading the file appears

writeToFile

public void writeToFile(java.io.File fileToWrite)
                 throws FileConversionException
Description copied from class: SubtitleFile
Method writeToFile.
Summary:
Use this method to write subtitle file to the given File.

Specified by:
writeToFile in class SubtitleFile
Parameters:
fileToWrite - The File to write the file.
Throws:
FileConversionException

writeToTemporaryFile

public void writeToTemporaryFile()
Description copied from class: SubtitleFile
Method writeToTemporaryFile.
Summary:
Use this method to write subtitle file to the temporary File.

Specified by:
writeToTemporaryFile in class SubtitleFile

getNewInstance

protected SubtitleFile getNewInstance()
Description copied from class: SubtitleFile
Method getNewInstance.
Summary:
This method should return a new instance of the current SubtitleFile class.

Specified by:
getNewInstance in class SubtitleFile
Returns:
SubtitleFile A new instance of the current SubtitleFile class.

extension

public java.lang.String extension()
Description copied from class: SubtitleFile
Returns the extension file

Specified by:
extension in class SubtitleFile
Returns:
the extension file