Hi Team,
I have a question regarding the commons-net-3.3.jar. The below code snippet is from FTPClient.java (available in commons-net-3.3-sources.jar). I am calling the method retrieveFile to download a file from a FTP server. I just want to know whether this stores the entire file content in the memory or writes the file directly to the disk? Can you clarify my query please? public boolean retrieveFile(String remote, OutputStream local) throws IOException { return _retrieveFile(FTPCmd.RETR.getCommand(), remote, local); } /** * @since 3.1 */ protected boolean _retrieveFile(String command, String remote, OutputStream local) throws IOException { Socket socket = _openDataConnection_(command, remote); if (socket == null) { return false; } InputStream input = getBufferedInputStream(socket.getInputStream()); if (__fileType == ASCII_FILE_TYPE) { input = new FromNetASCIIInputStream(input); } CSL csl = null; if (__controlKeepAliveTimeout > 0) { csl = new CSL(this, __controlKeepAliveTimeout, __controlKeepAliveReplyTimeout); } // Treat everything else as binary for now try { Util.copyStream(input, local, getBufferSize(), CopyStreamEvent.UNKNOWN_STREAM_SIZE, __mergeListeners(csl), false); } finally { Util.closeQuietly(input); Util.closeQuietly(socket); if (csl != null) { csl.cleanUp(); // fetch any outstanding keepalive replies } } // Get the transfer response boolean ok = completePendingCommand(); return ok; } Regards Murali