edu.iastate.utils.net.ftp
Class FtpUtils
java.lang.Object
edu.iastate.utils.net.ftp.FtpUtils
- public class FtpUtils
- extends java.lang.Object
|
Field Summary |
(package private) java.lang.StringBuffer |
cmdResponse
|
private int |
controlPort
|
(package private) java.net.Socket |
cs
|
(package private) int |
dataPort
|
(package private) static boolean |
DEBUGGING
|
(package private) java.io.BufferedReader |
DIN
|
(package private) java.io.PrintWriter |
DOUT
|
(package private) java.net.Socket |
ds
|
(package private) static java.lang.String |
eol
|
(package private) java.io.LineNumberReader |
IN
|
(package private) static java.lang.String |
myName
|
(package private) java.io.PrintWriter |
OUT
|
(package private) java.lang.String |
serverName
|
(package private) java.net.ServerSocket |
ss
|
(package private) java.util.Date |
startTime
|
(package private) java.util.Date |
stopTime
|
(package private) java.lang.String |
timedCommand
|
(package private) static java.lang.String |
USAGE
|
(package private) java.lang.String |
userName
|
|
Constructor Summary |
FtpUtils()
|
FtpUtils(java.lang.String ftpServer)
|
FtpUtils(java.lang.String ftpServer,
java.lang.String userName)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
myName
static java.lang.String myName
USAGE
static java.lang.String USAGE
DEBUGGING
static boolean DEBUGGING
controlPort
private int controlPort
eol
static java.lang.String eol
cs
java.net.Socket cs
ds
java.net.Socket ds
ss
java.net.ServerSocket ss
dataPort
int dataPort
serverName
java.lang.String serverName
userName
java.lang.String userName
OUT
java.io.PrintWriter OUT
DOUT
java.io.PrintWriter DOUT
IN
java.io.LineNumberReader IN
DIN
java.io.BufferedReader DIN
timedCommand
java.lang.String timedCommand
cmdResponse
java.lang.StringBuffer cmdResponse
startTime
java.util.Date startTime
stopTime
java.util.Date stopTime
FtpUtils
public FtpUtils()
FtpUtils
public FtpUtils(java.lang.String ftpServer)
FtpUtils
public FtpUtils(java.lang.String ftpServer,
java.lang.String userName)
setControlPort
public void setControlPort(int newPort)
getControlPort
public int getControlPort(int newPort)
sendCommand
public boolean sendCommand(java.lang.String command)
throws java.io.IOException
- Throws:
java.io.IOException
sendCommand
public boolean sendCommand(java.lang.String command,
boolean saveResults)
throws java.io.IOException
- Throws:
java.io.IOException
setTimedCommand
public void setTimedCommand(java.lang.String command)
getTimedCommand
public java.lang.String getTimedCommand()
setStartTime
public void setStartTime()
setStopTime
public void setStopTime()
resetTime
public void resetTime()
getDuration
public long getDuration()
getResponse
public boolean getResponse()
throws java.io.IOException
- Throws:
java.io.IOException
getResponse
public boolean getResponse(boolean saveResults)
throws java.io.IOException
- Throws:
java.io.IOException
extractMsg
public java.lang.String extractMsg(java.lang.String msg)
openAConnection
public boolean openAConnection(java.lang.String ftpServerName)
throws java.io.IOException
- Throws:
java.io.IOException
closeAConnection
public boolean closeAConnection()
login
public boolean login(java.lang.String username,
java.lang.String password)
throws java.io.IOException
- Throws:
java.io.IOException
openDataConnection
public boolean openDataConnection()
throws java.io.IOException
- Throws:
java.io.IOException
openPassiveDataConnection
public boolean openPassiveDataConnection()
throws java.io.IOException
- Throws:
java.io.IOException
closeDataConnection
public boolean closeDataConnection()
throws java.io.IOException
- Throws:
java.io.IOException
getData
public boolean getData()
throws java.io.IOException
- Throws:
java.io.IOException
putData
public boolean putData()
throws java.io.IOException
- Throws:
java.io.IOException
putFtp
public static boolean putFtp(java.lang.String localFile,
java.lang.String server,
java.lang.String user,
java.lang.String passwd,
java.lang.String remoteFile)
throws java.io.IOException
- upload a flie to ftp
- Parameters:
localFile - Stringserver - Stringuser - Stringpasswd - StringremoteFile - String
- Returns:
- boolean
- Throws:
java.io.IOException- Since:
- 2003-10
openUnixFtpInputStream
public java.io.InputStream openUnixFtpInputStream(java.lang.String ftpServer,
java.lang.String userName,
java.lang.String password,
java.lang.String file)
- remember to close!
- Returns:
- InputStream
- Since:
- 2005-03-05
getStream
public java.io.InputStream getStream()
throws java.io.IOException
- Throws:
java.io.IOException