You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-commits@incubator.apache.org by ng...@apache.org on 2007/01/20 16:15:30 UTC
svn commit: r498137 - in
/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver:
FtpDataConnection.java FtpDataConnectionFactory.java
Author: ngn
Date: Sat Jan 20 08:15:30 2007
New Revision: 498137
URL: http://svn.apache.org/viewvc?view=rev&rev=498137
Log:
Cleanup and adding javadoc
Modified:
incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnection.java
incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnectionFactory.java
Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnection.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnection.java?view=diff&rev=498137&r1=498136&r2=498137
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnection.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnection.java Sat Jan 20 08:15:30 2007
@@ -31,17 +31,13 @@
import java.util.zip.InflaterInputStream;
import org.apache.ftpserver.ftplet.DataType;
-import org.apache.ftpserver.ftplet.FtpSession;
-import org.apache.ftpserver.interfaces.FtpServerContext;
import org.apache.ftpserver.usermanager.TransferRateRequest;
import org.apache.ftpserver.util.IoUtils;
/**
- * We can get the ftp data connection using this class.
- * It uses either PORT or PASV command.
- *
- * @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a>
+ * An active open data connection, used for transfering data over the
+ * data connection.
*/
public
class FtpDataConnection {
@@ -108,7 +104,11 @@
}
/**
- * Transfer data.
+ * Transfer data from the client (e.g. STOR).
+ * @param out The {@link OutputStream} containing the destination
+ * of the data from the client.
+ * @return The length of the transefered data
+ * @throws IOException
*/
public final long transferFromClient(OutputStream out) throws IOException {
TransferRateRequest transferRateRequest = new TransferRateRequest();
@@ -126,6 +126,12 @@
}
}
+ /**
+ * Transfer data to the client (e.g. RETR).
+ * @param in Data to be transfered to the client
+ * @return The length of the transefered data
+ * @throws IOException
+ */
public final long transferToClient(InputStream in) throws IOException {
TransferRateRequest transferRateRequest = new TransferRateRequest();
transferRateRequest = (TransferRateRequest) session.getUser().authorize(transferRateRequest);
@@ -142,6 +148,11 @@
}
}
+ /**
+ * Transfer a string to the client, e.g. during LIST
+ * @param str The string to transfer
+ * @throws IOException
+ */
public final void transferToClient(String str) throws IOException {
OutputStream out = getDataOutputStream();
Writer writer = null;
Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnectionFactory.java?view=diff&rev=498137&r1=498136&r2=498137
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnectionFactory.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnectionFactory.java Sat Jan 20 08:15:30 2007
@@ -25,7 +25,6 @@
import org.apache.commons.logging.Log;
import org.apache.ftpserver.ftplet.FtpException;
-import org.apache.ftpserver.ftplet.FtpSession;
import org.apache.ftpserver.interfaces.DataConnectionConfig;
import org.apache.ftpserver.interfaces.FtpServerContext;
import org.apache.ftpserver.interfaces.Ssl;
@@ -191,6 +190,11 @@
return port;
}
+ /**
+ * Open an active data connection
+ * @return The open data connection
+ * @throws Exception
+ */
public FtpDataConnection openConnection() throws Exception {
return new FtpDataConnection(getDataSocket(), session, this);
}
@@ -198,7 +202,7 @@
/**
* Get the data socket. In case of error returns null.
*/
- public synchronized Socket getDataSocket() throws Exception {
+ private synchronized Socket getDataSocket() throws Exception {
// get socket depending on the selection
dataSoc = null;