• Post Reply Bookmark Topic Watch Topic
  • New Topic

FTPClient.retrieveFile() doesn't work properly.

 
Prabhat Gupta
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am facing a peculiar problem dealing with FTPClient.retrieveFile() when a try to transfer a file from Mainframe Server.
It is able to transfer the file but it adds unnecessary trailing spaces after the end of file which in turn causes the transferred file and original one not EXACTLY same.
I am using CommonsNet.jar(version 2.0).Any suggestions in this regard are most welcomed.

Thanks & Regards,
Prabhat
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q: Why are my files corrupt after transfer?

A: The most common cause for this is when the file is transfered as ASCII but the contents of the file are not ASCII and the file should be transferred as BINARY. RFC 959 says the default transfer mode should be ASCII. FTPClient conforms to the standard. You must explicitly call setFileType(FTP.BINARY_FILE_TYPE); to request binary transfer mode after logging in to the FTP server.


Apache Commons Net FAQ
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!