speedscheduler.io
Class BinaryScheduleIO

java.lang.Object
  extended by speedscheduler.io.BinaryScheduleIO
All Implemented Interfaces:
ScheduleIO

public class BinaryScheduleIO
extends java.lang.Object
implements ScheduleIO

An implementation of ScheduleIO that persists Schedules as binary serialized Java objects. TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates


Field Summary
protected  int defaultMaxDownloadRate
           
protected  int defaultMaxUploadRate
           
protected  java.util.Vector schedules
           
protected  boolean schedulesLoaded
           
 
Constructor Summary
BinaryScheduleIO()
           
 
Method Summary
 int getDefaultMaxDownloadSpeed()
           
 int getDefaultMaxUploadSpeed()
           
private  java.lang.String getSaveFileName()
          Helper function that tells us where to save the Schedules.
 java.util.Vector getSchedules()
          Fetches the loaded schedules.
 void loadSchedules()
          Loads the Schedules and default up/down rates from the saved file of binary Java Objects using an ObjectInputStream.
 void saveDefaultSpeeds(int defaultMaxUploadSpeed, int defaultMaxDownloadSpeed)
           
 void saveSchedules(java.util.Vector schedulesToSave, int defaultMaxUploadRate, int defaultMaxDownloadRate)
          Save these Schedules and default up/down rates to the persistent file using a vector of binary Java objects and the ObjectOutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schedules

protected java.util.Vector schedules

defaultMaxUploadRate

protected int defaultMaxUploadRate

defaultMaxDownloadRate

protected int defaultMaxDownloadRate

schedulesLoaded

protected boolean schedulesLoaded
Constructor Detail

BinaryScheduleIO

public BinaryScheduleIO()
Method Detail

getSchedules

public java.util.Vector getSchedules()
Fetches the loaded schedules.

Specified by:
getSchedules in interface ScheduleIO

saveSchedules

public void saveSchedules(java.util.Vector schedulesToSave,
                          int defaultMaxUploadRate,
                          int defaultMaxDownloadRate)
                   throws java.io.IOException
Save these Schedules and default up/down rates to the persistent file using a vector of binary Java objects and the ObjectOutputStream.

Specified by:
saveSchedules in interface ScheduleIO
Parameters:
schedulesToSave -
defaultMaxUploadRate -
defaultMaxDownloadRate -
Throws:
java.io.IOException

loadSchedules

public void loadSchedules()
                   throws java.io.IOException
Loads the Schedules and default up/down rates from the saved file of binary Java Objects using an ObjectInputStream.

Specified by:
loadSchedules in interface ScheduleIO
Throws:
java.io.IOException

getSaveFileName

private java.lang.String getSaveFileName()
Helper function that tells us where to save the Schedules.


getDefaultMaxUploadSpeed

public int getDefaultMaxUploadSpeed()
Specified by:
getDefaultMaxUploadSpeed in interface ScheduleIO
See Also:
ScheduleIO.getDefaultMaxUploadSpeed()

getDefaultMaxDownloadSpeed

public int getDefaultMaxDownloadSpeed()
Specified by:
getDefaultMaxDownloadSpeed in interface ScheduleIO
See Also:
ScheduleIO.getDefaultMaxDownloadSpeed()

saveDefaultSpeeds

public void saveDefaultSpeeds(int defaultMaxUploadSpeed,
                              int defaultMaxDownloadSpeed)
                       throws java.io.IOException
Specified by:
saveDefaultSpeeds in interface ScheduleIO
Throws:
java.io.IOException