cami
Class FileSizeChecker

java.lang.Object
  extended by java.lang.Thread
      extended by cami.FileSizeChecker
All Implemented Interfaces:
java.lang.Runnable

public class FileSizeChecker
extends java.lang.Thread

This class blocks a Thread until a certain filesize is reached.

Author:
Camillo Bruni

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int LOOP_BREAK
          number of times the check-loop will be repeated without any changes, until it will be breaked.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
FileSizeChecker(java.io.File f, int minimalSize)
           
 
Method Summary
 void run()
          loop as long as the file hasn't reached the minimalSize.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOOP_BREAK

public static final int LOOP_BREAK
number of times the check-loop will be repeated without any changes, until it will be breaked. A BufferedWriter normally writes 8192 bytes a time, so with a nice 56k modem this can take more than 2 seconds! But the check is performed 100 times per second, so at least 200-400 loops should be granted.

See Also:
Constant Field Values
Constructor Detail

FileSizeChecker

public FileSizeChecker(java.io.File f,
                       int minimalSize)
Parameters:
f - the file to check
minimalSize - minimal filesize in bytes
Method Detail

run

public void run()
loop as long as the file hasn't reached the minimalSize. As soon as the wanted filesize is reached, this thread is stopped and the programm can continue.
Make sure that the file will reache the specified size, otherwise this won't stop!!

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread