public class DataTransferThread extends Thread
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
protected IOException |
m_exception |
protected InputStream |
m_in |
protected boolean |
m_isBinaryTransfer |
protected OutputStream |
m_out |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
DataTransferThread() |
DataTransferThread(InputStream in,
OutputStream out,
boolean isBinaryTransfer)
Creates a DataTransferThread
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
getByteBuffer()
gets a bytes buffer
|
int |
getBytesTransfered() |
protected int |
getDesiredBufferSize()
determines the size of the byte buffer
|
IOException |
getException()
Returns an Exception if one exists
usage -- call this method after the thread has run to get an Exception if one occured
|
void |
reset(InputStream in,
OutputStream out,
boolean isBinaryTransfer) |
void |
run()
Transfers the content from InputStream to OutputStream
|
void |
throwException()
Throws an Exception if one exists
usage -- call this method after the thread has run to have exception thrown
|
protected int |
transferAsciiData(InputStream in,
OutputStream out)
Transfer content from an inputstream to an outputstream,
processing newlines.
|
protected int |
transferBinaryData(InputStream in,
OutputStream out)
Transfer content from an inputstream to an outputstream,
with no newline processing
|
protected int |
transferData(InputStream in,
OutputStream out,
boolean isBinaryTransfer)
Transfers content from inputstream to outputstream
|
activeCount, checkAccess, clone, 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
protected InputStream m_in
protected OutputStream m_out
protected boolean m_isBinaryTransfer
protected IOException m_exception
public DataTransferThread()
public DataTransferThread(InputStream in, OutputStream out, boolean isBinaryTransfer)
isBinaryTransfer
- boolean to transfer in binary or asciipublic void reset(InputStream in, OutputStream out, boolean isBinaryTransfer)
public void run()
public void throwException() throws IOException
IOException
public IOException getException()
public int getBytesTransfered()
protected int transferData(InputStream in, OutputStream out, boolean isBinaryTransfer) throws IOException
in
- the input streamout
- the output streamisBinaryTransfer
- if true binary transfer, if false ascii transfer with bytes put on wire according to ftp rfc (noIOException
protected final int transferBinaryData(InputStream in, OutputStream out) throws IOException
IOException
protected final int transferAsciiData(InputStream in, OutputStream out) throws IOException
IOException
protected int getDesiredBufferSize()
protected byte[] getByteBuffer()
Copyright © 2023. All rights reserved.