TV-Browser 2.7.5 API

tvbrowserdataservice.file
Class DayProgramFile

java.lang.Object
  extended by tvbrowserdataservice.file.AbstractFile
      extended by tvbrowserdataservice.file.DayProgramFile

public class DayProgramFile
extends AbstractFile

Author:
Til Schneider, www.murfman.de

Field Summary
static TvDataLevel[] LEVEL_ARR
           
static Localizer mLocalizer
          The localizer for this class.
 
Constructor Summary
DayProgramFile()
           
DayProgramFile(Date date, Channel channel)
           
 
Method Summary
 void addProgramFrame(ProgramFrame frame)
           
 void checkFormat()
           
 boolean equals(Object obj)
           
 Channel getChannel()
           
static String getChannelNameFromFileName(String fileName)
           
static String getCountryFromFileName(String fileName)
           
 Date getDate()
           
static Date getDateFromFileName(String fileName)
           
static String getLevelFromFileName(String fileName)
           
static int getLevelIndexForId(String levelId)
           
 String getProgramFileName()
           
static String getProgramFileName(Date date, Channel channel)
           
static String getProgramFileName(Date date, String country, String channel)
           
static String getProgramFileName(Date date, String country, String channel, String level)
           
static String getProgramFileName(Date date, String country, String channel, String level, int updateVersion)
           
 ProgramFrame getProgramFrameAt(int index)
           
 int getProgramFrameCount()
           
 int getProgramFrameIndexForId(int id)
           
 int getVersion()
           
 void merge(DayProgramFile otherProg)
          Merges the day program file with a day program file of another level.
 void readFromStream(InputStream stream, DownloadJob job)
           
static int readVersionFromFile(File file)
           
static int readVersionFromStream(InputStream stream)
          Reads only the version from a stream.
 void removeAllProgramFrames()
           
 void removeProgramFrameAt(int index)
           
 void setVersion(int version)
           
 void updateCompleteFile(DayProgramFile updateFile)
          Updates this complete file with an update file.
 void updateUpdateFile(DayProgramFile updateFile)
          Updates this update file with an update file.
 void writeToStream(OutputStream stream, File file)
           
 
Methods inherited from class tvbrowserdataservice.file.AbstractFile
readFromFile, writeToFile
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mLocalizer

public static final Localizer mLocalizer
The localizer for this class.


LEVEL_ARR

public static final TvDataLevel[] LEVEL_ARR
Constructor Detail

DayProgramFile

public DayProgramFile()

DayProgramFile

public DayProgramFile(Date date,
                      Channel channel)
Method Detail

getDate

public Date getDate()

getChannel

public Channel getChannel()

getVersion

public int getVersion()

setVersion

public void setVersion(int version)
Parameters:
version -

getProgramFrameCount

public int getProgramFrameCount()

getProgramFrameAt

public ProgramFrame getProgramFrameAt(int index)

removeProgramFrameAt

public void removeProgramFrameAt(int index)

removeAllProgramFrames

public void removeAllProgramFrames()

addProgramFrame

public void addProgramFrame(ProgramFrame frame)

getProgramFrameIndexForId

public int getProgramFrameIndexForId(int id)

updateCompleteFile

public void updateCompleteFile(DayProgramFile updateFile)
                        throws FileFormatException
Updates this complete file with an update file.

Parameters:
updateFile - The update to use to patch this day program file.
Throws:
FileFormatException - If the update file does not have a higher version as this file.
See Also:
updateUpdateFile(DayProgramFile), merge(DayProgramFile)

updateUpdateFile

public void updateUpdateFile(DayProgramFile updateFile)
                      throws FileFormatException
Updates this update file with an update file.

Parameters:
updateFile - The update to use to patch this day program file.
Throws:
FileFormatException - If the update file does not have a higher version as this file.
See Also:
updateCompleteFile(DayProgramFile), merge(DayProgramFile)

merge

public void merge(DayProgramFile otherProg)
           throws FileFormatException
Merges the day program file with a day program file of another level.

Parameters:
otherProg - The day program file to merge with this file.
Throws:
FileFormatException - If merging failed.
See Also:
updateCompleteFile(DayProgramFile), updateUpdateFile(DayProgramFile)

checkFormat

public void checkFormat()
                 throws FileFormatException
Throws:
FileFormatException

readVersionFromStream

public static int readVersionFromStream(InputStream stream)
                                 throws IOException,
                                        FileFormatException
Reads only the version from a stream.

Parameters:
stream - The stream to read from
Returns:
The version of the file
Throws:
IOException - If reading failed
FileFormatException - If the file has a unknown file version

readVersionFromFile

public static int readVersionFromFile(File file)
                               throws IOException,
                                      FileFormatException
Throws:
IOException
FileFormatException

readFromStream

public void readFromStream(InputStream stream,
                           DownloadJob job)
                    throws IOException,
                           FileFormatException
Specified by:
readFromStream in class AbstractFile
Throws:
IOException
FileFormatException

writeToStream

public void writeToStream(OutputStream stream,
                          File file)
                   throws IOException,
                          FileFormatException
Specified by:
writeToStream in class AbstractFile
Throws:
IOException
FileFormatException

getProgramFileName

public String getProgramFileName()

getProgramFileName

public static String getProgramFileName(Date date,
                                        Channel channel)

getProgramFileName

public static String getProgramFileName(Date date,
                                        String country,
                                        String channel)

getProgramFileName

public static String getProgramFileName(Date date,
                                        String country,
                                        String channel,
                                        String level)

getProgramFileName

public static String getProgramFileName(Date date,
                                        String country,
                                        String channel,
                                        String level,
                                        int updateVersion)

getDateFromFileName

public static Date getDateFromFileName(String fileName)
                                throws TvBrowserException
Throws:
TvBrowserException

getCountryFromFileName

public static String getCountryFromFileName(String fileName)
                                     throws TvBrowserException
Throws:
TvBrowserException

getChannelNameFromFileName

public static String getChannelNameFromFileName(String fileName)
                                         throws TvBrowserException
Throws:
TvBrowserException

getLevelFromFileName

public static String getLevelFromFileName(String fileName)
                                   throws TvBrowserException
Throws:
TvBrowserException

getLevelIndexForId

public static int getLevelIndexForId(String levelId)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

TV-Browser 2.7.5 API

TV-Browser 2.7.5, Copyright (C) 04-2003 Martin Oberhauser (martin@tvbrowser.org)