Friday, May 25, 2007

FTPClient Default Buffer Policy

Just found this while researching the buffer policy of (Apache commons net FTP).

Methods storeFile() and retrieveFile() in FTPClient use a default buffer size of 1024 (

Methods storeFileAsStream() and retrieveFileStream() do not use a default buffer when file type is BINARY however when file type is ASCII they use a default buffer of 1024. Here's the developer's comment as to why

// We buffer ascii transfers because the buffering has to
// be interposed between ToNetASCIIOutputSream and the underlying
// socket output stream. We don't buffer binary transfers
// because we don't want to impose a buffering policy on the
// programmer if possible. Programmers can decide on their
// own if they want to wrap the SocketOutputStream we return
// for file types other than ASCII.

No comments:

Post a Comment