Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

MochaBackupClasses
Class MochaBackupThread  view MochaBackupThread download MochaBackupThread.java

java.lang.Object
  extended byjava.lang.Thread
      extended byMochaBackupClasses.MochaBackupThread
All Implemented Interfaces:
java.lang.Runnable

public final class MochaBackupThread
extends java.lang.Thread

MochaBackupThread is the the thread that handles most of the work for the backup process. Once started, it will go through the requested process until requested to cancel.
Note: I know it's not good practice to access a window's GUI components from another thread. In windows programming, this is a big no no with MFC. I haven't seen any evidence that indicates this in Java yet so I'll just leave it as it is for now until I find evidence and decide to change it.


Nested Class Summary
static class MochaBackupThread.MochaThreadData
          Class for a thread data object to pass various Swing control references and other options to the backup thread.
 
Nested classes inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  MochaBackupThread.MochaThreadData mochaThreadData
           
private  double percentMod
           
private  int totalFileCount
           
private  int totalFilesComplete
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MochaBackupThread(MochaBackupThread.MochaThreadData threadData)
           
 
Method Summary
private  void addDirToZip(java.util.zip.ZipOutputStream outputZip, java.io.File path, boolean useAbsolute)
          Add a file or path to the zip archive specified by outputZip.
private  void addFileToZip(java.util.zip.ZipOutputStream outputZip, java.io.File file, boolean useAbsolute)
          Add a file to the zip archive specified by outputZip.
private  int analyzeFiles(java.io.File path)
           
private  void backup()
           
 void run()
          The method of Thread that will be run if there is no Runnable object associated with the Thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mochaThreadData

private MochaBackupThread.MochaThreadData mochaThreadData

totalFileCount

private int totalFileCount

totalFilesComplete

private int totalFilesComplete

percentMod

private double percentMod
Constructor Detail

MochaBackupThread

public MochaBackupThread(MochaBackupThread.MochaThreadData threadData)
Method Detail

addFileToZip

private void addFileToZip(java.util.zip.ZipOutputStream outputZip,
                          java.io.File file,
                          boolean useAbsolute)
                   throws java.io.IOException
Add a file to the zip archive specified by outputZip. This method also updates the progress bar, and the text area.


addDirToZip

private void addDirToZip(java.util.zip.ZipOutputStream outputZip,
                         java.io.File path,
                         boolean useAbsolute)
                  throws java.io.IOException
Add a file or path to the zip archive specified by outputZip. This method also updates the progress bar, and the text area.


analyzeFiles

private int analyzeFiles(java.io.File path)

backup

private void backup()

run

public void run()
Description copied from class: java.lang.Thread
The method of Thread that will be run if there is no Runnable object associated with the Thread. Thread's implementation does nothing at all.