FtpBean
This is a Ftp Bean which provide
basic ftp client functions (eg. get or put ascii/binary file, delete file,
rename file, change directory ...... etc). It is written in Java1.1 code
and it is free for anyone to use it and distribute it.
Update
version 1.4.5 or later
- I am NOT going to update
the 'Update' section for this page (i am lazy) anymore. Please download the
files and see the history header in the source code if you are interested.
version 1.4.4 - 10, March 2001
- Fixed bug on the getPassiveSocket
method which pass incorrect server and port information when using the
SocketOpener class for openning new socket.
- Fixed bug on the getDataSocket
method where the ServerSocket is not closed when using active mode transfer.
This may cause problem if there are too many ServerSocket opened.
- Fixed bug on most of the
get/put file methods where the setTransferType is not enclosed in the
"try" block.
- Fix bug on parsing DOS
format list with name contains more than 1 space.
- Fix bug on parsing UNIX
format list with the first word of the name is also contains in the date
or size.
version 1.4.3 - 31, Jan 2001
- Increase code efficiency
for private method getBytes(BufferedInputStream, FtpObserver). This increase
the of those get file methods that return a byte array or String.
- Private method getPassiveDataSocket()
changed, so that it read the ip address returned from the PASV command
rather than using the getServerName method as the host. 3
- Added the SocketOpener
class to deal with add timeout feature for openning Socket.
- Changed the way to get
new Socket in ftpConnect and getPassiveSocket methods to support * the
timeout feature if it is being set.
- Public method getSocketTimeout()
added.
- Public method setSocketTimeout(int)
added.
- Public method getAsciiFile(String,
String, String) added.
- Public method getAsciiFile(String,
String, String, FtpObserver) added.
version 1.4.2 - 1, Aug 2000
- Fixed bug on dead lock
in close() method when sing putBinaryFile(String, String) to upload
a non-existing local file.
- Fixed bug on parsing list
with file name contains more than 1 space.
version 1.4.1 - 19, May 2000
- Fixed bug on FtpListResult
class.
- Fixed bug on dead lock
may caused by active mode data transfer.
- Fixed bug on dead lock
may caused by passive mode datat transfer.
- Public method execute()
added.
- Public methd getSystemType
added.
version 1.4 - 19, April 2000
- New interface FtpObserver
added.
- New class FtpListResultBeanInfo
added.
- FtpListResult can parse
for MS-DOS format list now.
- Added methods to FtpBean
to support the FtpObserver interface.
version 1.3.2 - 10, February
2000
- Fixed bug on FtpListResult
class.
version 1.3.1 - 1, February
2000
- Fixed bug on deadlock
during incorrect login.
- Fixed bug on FtpListResult
class.
version 1.3 - 20,January 2000
- New class FtpListResult
added.
- Public method getDirectoryContent()
changed to getDirectoryContentAsString().
- Public method getPassiveModeTransfer()
changed to isPassiveModeTransfer().
- Public method getDirectoryContent()
added.
- Thread safe.
- Private method aquire
added.
- Private method release
added.
version 1.2 - 6, Nov 1999
- Public method putBinaryFile(String,
String) added.
- Public method putBinaryFile(String,
String, long) added.
- Public method getReply()
added.
- Public method getAsciiFile(String)
changed to getAsciiFile(String, String).
- Public method putAsciiFile(String,
String) changed to putAsciiFile(String, String, String).
- Public method getPassive()
changed to getPassiveModeTransfer().
- Public method setPassive(boolean)
changed to putPassiveModeTransfer(boolean).
- Debug mode supported
version 1.1 - 21, Aug 1999
- Provide active data transfer
mode (Using PORT command).
- Public method setPassive(boolean)
added.
- Public method getPassive()
added.
- Fixed bug on getting
binary file on a restarting point as a byte array.
Package
There are five classes and one
interface in the bean, all belong to the package "ftp", they are:
classes:
- ftp.FtpBean
- The main class which provide
basic operation.
- ftp.FtpException
- The exception which will
be threw for any non-successful operation (eg. you want to get a
file from the server through ftp but the file doesn't exist or
permission denied.).
- ftp.FtpListResult
- A class for parsing information
from the result of ftp LIST command.
- ftp.FtpBeanBeanInfo
- Bean info class for FtpBean.
This is only for some visual IDE (eg. IBM Visual Age) to better
understand the bean.
- ftp.FtpListResultBeanInfo
- Bean info class for FtpListResult.
This is only for some visual IDE (eg. IBM Visual Age) to
better understand the bean.
- ftp.FtpReplyResourceBundle
- Resource bundle that contains
valid reply code for various ftp commands.
interfaces:
- ftp.FtpObserver
- Classes that implement this
inteface can have the ability to monitor the progress of some
uploading and downloading process.
Features
- Connect to ftp host.
- Passive and active data
transmission.
- File delete.
- File rename.
- Get and put ascii files.
- Get and put binary files.
- Get and put binary files
with a restarting point.
- Get directory name (PWD).
- Change directory (CWD).
- Make directory.
- Remove directory.
- Set port number.
- Get port number.
- Get host name.
- Get remote system types
- Get user name.
- Get reply from server.
- Get reply message from
server.
- Execute command via ftp.
- Thread safe.
- Parsing information from
the LIST command including file name, file size, owner, group and permission.
- Monitor the uploading and
downloading process of the bean.
Coming Goals
- Implement methods to handle
ascii files but not use too many memory.
- File name filter for parsing
list
- Server to server transmission.
- Maintain backward compability.
Requirment
JDK 1.1 compatible Java Virtual
Machine.
Platform
It is written in pure Java.
So it can be run on any supported platform.
Download
This FtpBean is free to download
and use. The last version is 1.4.5
You are welcomed to download,
it includes class files, a jar file, source code and documentation:
Last version
Windows zip format
UNIX compressed tar ball
Old versions
1.4.4
Window zip format
UNIX compressed tar ball
1.4.3
Window zip format
UNIX compressed tar ball
1.4.2
Windows zip format
UNIX compressed tar ball
Thanks
Thanks for Wayne
Conrad who provides the SocketOpener class.
Special Thanks
for the following persons pointed out some bugs or gave useful suggestions
on this bean:
Niels
Ull Harremoes
Minzhuan Gong
igor
Morris Cavan
Vincent Mahon
Brian Wohlin
Todd Gleason
Josef Gierbl
Todd Kirby
Niels Harremoes
szetoo yutit
Clinton Bosch
Stephen
Porterfield
Russell Gold
Victor Mikhailov
Thomson Danielle
Martin Crawford
Mahesh Sharma
Steve
Stock
Jorge Gayo
Rob Desilets
Dave Slaughter
Lars Uhver
Wes
Gary Peskin
David Buchwald
Thomas Angioletti
Brian Wohlin
Please send me an e-mail if you have any comments on it or
you find it useful. Thanks
Back to HOME