|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
com.groovemanager.thread.ProgressThread
com.groovemanager.thread.SaveFileThread
This ProgressThread implementation can be used for writing data from an InputStream to an OutputStream
| Nested Class Summary |
|---|
| Nested classes inherited from class java.lang.Thread |
|---|
java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected byte[] |
buffer
Temporary buffer |
protected boolean |
closeAtEnd
Indicates, whether the streams should be closed when finishing the read/write operation or not |
static int |
DEFAULT_BUFFER_SIZE
The default buffer size to use |
protected int |
frameLength
The length in frames to be written |
protected int |
frameSize
The size of one frame |
protected java.io.InputStream |
in
The InputStream to read from |
protected int |
numBytesRead
The number of bytes read in the last read operation. |
protected java.io.OutputStream |
out
The OutputStream to write to |
protected int |
written
The number of bytes written so far |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
SaveFileThread(java.io.InputStream in,
java.io.OutputStream out,
int frameLength,
int frameSize)
Create a new SaveFileThread using the default buffer size. |
|
SaveFileThread(java.io.InputStream in,
java.io.OutputStream out,
int frameLength,
int frameSize,
boolean closeAtEnd)
Create a new SaveFileThread using the default buffer size. |
|
SaveFileThread(java.io.InputStream in,
java.io.OutputStream out,
int frameLength,
int frameSize,
boolean closeAtEnd,
int bufferSize)
Create a new SaveFileThread |
|
SaveFileThread(java.io.InputStream in,
java.io.OutputStream out,
int frameLength,
int frameSize,
int bufferSize)
Create a new SaveFileThread. |
|
| Method Summary | |
|---|---|
protected boolean |
breakCondition()
The break condition to indicate that the operation has finished |
protected void |
cleanUp()
Free any ressources and perform clean up operations. |
protected void |
init()
Any kind of initialization in the moment right before starting the operation should be performed here |
protected void |
processNext()
Perform the next step. |
protected java.lang.Object |
result()
Specify the result of this operation, if any. |
protected int |
tellElapsed()
Tell the length of the operation elapsed so for |
protected int |
tellTotal()
Tell the total length of the operation |
| Methods inherited from class com.groovemanager.thread.ProgressThread |
|---|
cancelOperation, getElapsed, getErrorMessage, getResult, getTotal, hasFinished, run, setMonitor |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, 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 |
|---|
protected byte[] buffer
protected boolean closeAtEnd
public static final int DEFAULT_BUFFER_SIZE
protected int frameLength
protected int frameSize
protected java.io.InputStream in
protected int numBytesRead
protected java.io.OutputStream out
protected int written
| Constructor Detail |
|---|
public SaveFileThread(java.io.InputStream in,
java.io.OutputStream out,
int frameLength,
int frameSize)
in - The InputStream to read fromout - The OutputStream to write toframeLength - The number of frames to writeframeSize - The size of one frame in bytes
public SaveFileThread(java.io.InputStream in,
java.io.OutputStream out,
int frameLength,
int frameSize,
boolean closeAtEnd)
in - The InputStream to read fromout - The OutputStream to write toframeLength - The number of frames to writeframeSize - The size of one frame in bytescloseAtEnd - true, if the given streams should be closed when ready,
false otherwise
public SaveFileThread(java.io.InputStream in,
java.io.OutputStream out,
int frameLength,
int frameSize,
boolean closeAtEnd,
int bufferSize)
in - The InputStream to read fromout - The OutputStream to write toframeLength - The number of frames to writeframeSize - The size of one frame in bytescloseAtEnd - true, if the given streams should be closed when ready,
false otherwisebufferSize - The buffer size in bytes to be used
public SaveFileThread(java.io.InputStream in,
java.io.OutputStream out,
int frameLength,
int frameSize,
int bufferSize)
in - The InputStream to read fromout - The OutputStream to write toframeLength - The number of frames to writeframeSize - The size of one frame in bytesbufferSize - The buffer size in bytes to be used| Method Detail |
|---|
protected boolean breakCondition()
ProgressThread
breakCondition in class ProgressThreadprotected void cleanUp()
ProgressThread
cleanUp in class ProgressThreadprotected void init()
ProgressThread
init in class ProgressThreadprotected void processNext()
ProgressThreadtellElpased() < tellTotal() andbreakCondition() != true and
processNext in class ProgressThreadprotected java.lang.Object result()
ProgressThread
result in class ProgressThreadnull should onlx be returned, if the operation
didnīt finish correctly. If it did finish correctly, but it has no
result, a dummy object should be returned.protected int tellElapsed()
ProgressThread
tellElapsed in class ProgressThreadprotected int tellTotal()
ProgressThread
tellTotal in class ProgressThread
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||