Author: sebb
Date: Sat Nov 12 01:11:43 2011
New Revision: 1201139
URL: http://svn.apache.org/viewvc?rev=1201139&view=rev
Log:
NET-425 Extend implementation to receiveFile and receiveFileStream methods.
Modified:
commons/proper/net/trunk/src/changes/changes.xml
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Modified: commons/proper/net/trunk/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1201139&r1=1201138&r2=1201139&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml (original)
+++ commons/proper/net/trunk/src/changes/changes.xml Sat Nov 12 01:11:43 2011
@@ -61,6 +61,7 @@ TBA
">
<action issue="NET-425" dev="sebb" type="add">
_openDataConnection_, __storeFile, and __storeFileStream should be
protected and take String for FTP command.
+ Likewise for receiveFile and receiveFileStream.
</action>
<action issue="NET-416" dev="sebb" type="update">
Increasing sub-negotiation message holder array size
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=1201139&r1=1201138&r2=1201139&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Sat Nov 12 01:11:43 2011
@@ -1625,10 +1625,16 @@ implements Configurable
public boolean retrieveFile(String remote, OutputStream local)
throws IOException
{
+ return _retrieveFile(FTPCommand.getCommand(FTPCommand.RETR), remote,
local);
+ }
+
+ protected boolean _retrieveFile(String command, String remote,
OutputStream local)
+ throws IOException
+ {
InputStream input;
Socket socket;
- if ((socket = _openDataConnection_(FTPCommand.RETR, remote)) == null)
+ if ((socket = _openDataConnection_(command, remote)) == null)
return false;
input = new BufferedInputStream(socket.getInputStream(),
@@ -1688,10 +1694,16 @@ implements Configurable
***/
public InputStream retrieveFileStream(String remote) throws IOException
{
+ return _retrieveFileStream(FTPCommand.getCommand(FTPCommand.RETR),
remote);
+ }
+
+ protected InputStream _retrieveFileStream(String command, String remote)
+ throws IOException
+ {
InputStream input;
Socket socket;
- if ((socket = _openDataConnection_(FTPCommand.RETR, remote)) == null)
+ if ((socket = _openDataConnection_(command, remote)) == null)
return null;
input = socket.getInputStream();