commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel F. Savarese" <>
Subject Re: [PATCH] performance problem w/ FTPClient
Date Sat, 15 Mar 2003 21:24:50 GMT

I forgot to add that my comment doesn't mean that the ASCII transfers
couldn't be optimized.  It's probably better to read the file in big
chunks, scan the chunks and translate to another buffer (twice the
size to handle the degenerate case of every character being a line
feed), and write that buffer.  ToNetASCIIOutputStream calls write(int ch)
from write(byte[]), which is bad if the underlying output stream isn't
buffered.  Although ToNetASCIIOutputStream could be improved, the real
culprit is FTPClient.__storeFileStream(), which does the following
        if (__fileType == ASCII_FILE_TYPE)
            output = new ToNetASCIIOutputStream(output);
instead of
        if (__fileType == ASCII_FILE_TYPE)
            output = new ToNetASCIIOutputStream(new BufferedOutputStream(output));
FTPClient.__storeFile() doesn't make that mistake.  I'll make the change in
__storeFileStream(), but some performance testing would be necessary to arrive
at appropriate buffer sizes.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message