sears.file
Class SsaFile

java.lang.Object
  extended by sears.file.SubtitleFile
      extended by sears.file.SsaFile
Direct Known Subclasses:
AssFile

public class SsaFile
extends SubtitleFile

This class represents a ssa subtitle file. Specialize the SubtitleFile for ssa type subtitles. It represents too an ass subtitle file too.


Field Summary
static java.lang.String DIALOGUE_KEY
           
static java.lang.String EVENTS_SECTION_DELIMITER
          Identifier key for the events section
static java.lang.String FORMAT_KEY
           
 
Fields inherited from class sears.file.SubtitleFile
BASIC_CHARSETS, DEFAULT_CHARSET, file, fileChanged, subtitleList, temporaryFile
 
Constructor Summary
SsaFile()
          Constructor SsaFile.
SsaFile(java.io.File file, java.util.ArrayList<Subtitle> subtitleList)
          Constructor SsaFile.
SsaFile(java.io.File file, java.util.ArrayList<Subtitle> subtitleList, java.lang.String charset)
           
SsaFile(java.lang.String file, java.util.ArrayList<Subtitle> subtitleList)
          Constructor SsaFile.
 
Method Summary
 java.lang.String extension()
          Returns the extension file
protected  java.lang.String[] getFieldsKey()
           
protected  SubtitleFile getNewInstance()
          Method getNewInstance.
protected  void parse()
          Method parse.
protected  void setBeginPart(java.lang.String beginPart)
           
protected  void setEndPart(java.lang.String endPart)
           
protected  void setFieldsKey(java.lang.String[] fieldsKey)
           
 SubtitleFile[] split(java.io.File[] destinationFiles, int subtitleIndex, int secondPartDelay)
          Method split.
static int stringToTime(java.lang.String time)
          Method stringToTime.
static java.lang.String timeToString(int milliseconds)
          Method timeToString.
 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, timeRepair
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIALOGUE_KEY

public static final java.lang.String DIALOGUE_KEY
See Also:
Constant Field Values

FORMAT_KEY

public static final java.lang.String FORMAT_KEY
See Also:
Constant Field Values

EVENTS_SECTION_DELIMITER

public static final java.lang.String EVENTS_SECTION_DELIMITER
Identifier key for the events section

See Also:
Constant Field Values
Constructor Detail

SsaFile

public SsaFile()
Constructor SsaFile.
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.


SsaFile

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

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

SsaFile

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

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

SsaFile

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

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.

setFieldsKey

protected void setFieldsKey(java.lang.String[] fieldsKey)

getFieldsKey

protected java.lang.String[] getFieldsKey()

setBeginPart

protected void setBeginPart(java.lang.String beginPart)

setEndPart

protected void setEndPart(java.lang.String endPart)

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

stringToTime

public static int stringToTime(java.lang.String time)
                        throws java.lang.NumberFormatException
Method stringToTime.
Summary:
Return the number of miliseconds that correspond to the given String time representation.

Parameters:
time - The string ssa time representation.
Returns:
(int) The corresponding number of miliseconds.
Throws:
java.lang.NumberFormatException

timeToString

public static java.lang.String timeToString(int milliseconds)
Method timeToString.
Summary:
This method transform a number of milliseconds in a string representation.

Parameters:
milliseconds - The number of milliseconds to transform
Returns:
(String) The corresponding String representation of the number of milliseconds.

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

split

public SubtitleFile[] split(java.io.File[] destinationFiles,
                            int subtitleIndex,
                            int secondPartDelay)
Description copied from class: SubtitleFile
Method split.
Summary:
This method split the subtitle file in two part at the given subtitle index. The two part will be saved in the given destination files, and a delay will be applied to the second part.

Overrides:
split in class SubtitleFile
Parameters:
destinationFiles - The File[] where to save the two parts of the file.
subtitleIndex - The int subtitle index, from wich create the second part of the subtitle.
secondPartDelay - The int initial delay to apply to the second part.
Returns:
an array of two SubtitleFile object