ip1.ex14
Class JFtpData

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--ip1.ex14.JFtpThread
              |
              +--ip1.ex14.JFtpData
All Implemented Interfaces:
java.lang.Runnable

public class JFtpData
extends JFtpThread

The JFtpData class implements an FTP data thread. It supports both active and passive data connections. A data thread is owned by a JFtpControl thread.

Version:
$Id: JFtpData.java,v 1.24 2003/10/17 14:03:39 sharky Exp $
See Also:
JFtpControl

Nested Class Summary
(package private)  class JFtpData.DataQueueItem
          Describes an item of a JFTpData's queue.
 
Nested classes inherited from class ip1.ex14.JFtpThread
 
Field Summary
(package private)  char[] charBuffer
          Character buffer for file transfers.
(package private) static int charBufferSize
          Size of the buffer for file transfers.
(package private)  boolean passive
          Are we in passive mode?
protected  long progress
          The progress indicator.
protected  java.lang.StringBuffer sb
          String buffer.
protected  java.net.Socket sock
          The data socket
protected  java.net.InetSocketAddress sockAddr
          Where to connect to (for passive mode)
protected  java.net.ServerSocket sockListen
          Listening socket (for active mode)
static int STATE_CONNECTED
          We have a connection.
static int STATE_CONNECTING
          We are attempting to connect (initial state).
protected  long targetSize
          The target size.
 
Fields inherited from class ip1.ex14.JFtpThread
children, counter, id, node, parent, queue, state, STATE_EXITED, STATE_NOTRUNNING, STATE_SHUTDOWN, threadTree, threadTreeChanged, type
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
(package private) JFtpData(JFtpControl parent)
          The constructor.
(package private) JFtpData(JFtpControl parent, long targetSize)
          Variant of the constructor.
 
Method Summary
 void queueReadStr(java.lang.StringBuffer sb)
          Queue reading to a StringBuffer.
 void queueReceive(java.io.File file)
          Queue receiving a file from the server.
 void queueSend(java.io.File file)
          Queue sending a local file to the server.
 void run()
          Establish the data connection.
 java.lang.String toString()
          String representation.
 
Methods inherited from class ip1.ex14.JFtpThread
addChild, addQueue, debug, dumpQueue, getChild, getRoot, isBusy, peekQueue, propagateTreeChange, queueShutdown, readQueue, refreshNode, refreshThreadView, removeChild, reset, shutdown, waitShutdown
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sb

protected java.lang.StringBuffer sb
String buffer.


sock

protected java.net.Socket sock
The data socket


sockListen

protected java.net.ServerSocket sockListen
Listening socket (for active mode)


sockAddr

protected java.net.InetSocketAddress sockAddr
Where to connect to (for passive mode)


progress

protected long progress
The progress indicator.


targetSize

protected long targetSize
The target size.


STATE_CONNECTING

public static final int STATE_CONNECTING
We are attempting to connect (initial state).

See Also:
Constant Field Values

STATE_CONNECTED

public static final int STATE_CONNECTED
We have a connection.

See Also:
Constant Field Values

passive

boolean passive
Are we in passive mode?


charBufferSize

static final int charBufferSize
Size of the buffer for file transfers.

See Also:
Constant Field Values

charBuffer

char[] charBuffer
Character buffer for file transfers.

Constructor Detail

JFtpData

JFtpData(JFtpControl parent,
         long targetSize)
   throws java.io.IOException
Variant of the constructor.


JFtpData

JFtpData(JFtpControl parent)
   throws java.io.IOException
The constructor.

Method Detail

queueReceive

public void queueReceive(java.io.File file)
Queue receiving a file from the server.

Parameters:
file - the file we output to.

queueReadStr

public void queueReadStr(java.lang.StringBuffer sb)
Queue reading to a StringBuffer.

Parameters:
sb - the StringBuffer to output to.
See Also:
JFtpControl.makeList()

queueSend

public void queueSend(java.io.File file)
Queue sending a local file to the server.


run

public void run()
Establish the data connection.

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

toString

public java.lang.String toString()
String representation.

Overrides:
toString in class JFtpThread