Package org.eclipse.jgit.util.io
Class StreamCopyThread
java.lang.Object
java.lang.Thread
org.eclipse.jgit.util.io.StreamCopyThread
- All Implemented Interfaces:
Runnable
Thread to copy from an input stream to an output stream.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private boolean
private final OutputStream
private final InputStream
private final Object
Lock held by flush to avoid interrupting a write.Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a thread to copy data from an input stream to an output stream. -
Method Summary
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
BUFFER_SIZE
private static final int BUFFER_SIZE- See Also:
-
src
-
dst
-
done
private volatile boolean done -
writeLock
Lock held by flush to avoid interrupting a write.
-
-
Constructor Details
-
StreamCopyThread
Create a thread to copy data from an input stream to an output stream.- Parameters:
i
- stream to copy from. The thread terminates when this stream reaches EOF. The thread closes this stream before it exits.o
- stream to copy into. The destination stream is automatically closed when the thread terminates.
-
-
Method Details
-
halt
Request that the thread terminate, and wait for it.This method signals to the copy thread that it should stop as soon as there is no more IO occurring.
- Throws:
InterruptedException
- the calling thread was interrupted.
-
run
public void run()
-