You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/01/23 20:47:42 UTC

svn commit: r1437659 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java

Author: sebb
Date: Wed Jan 23 19:47:41 2013
New Revision: 1437659

URL: http://svn.apache.org/viewvc?rev=1437659&view=rev
Log:
Simplify, in light of NET-496

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java

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=1437659&r1=1437658&r2=1437659&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 Wed Jan 23 19:47:41 2013
@@ -630,9 +630,9 @@ implements Configurable
 
         if (__fileType == ASCII_FILE_TYPE) {
             output = new ToNetASCIIOutputStream(
-                     new BufferedOutputStream(socket.getOutputStream(), getDefaultedBufferSize()));
+                     new BufferedOutputStream(socket.getOutputStream(), getBufferSize()));
         } else {
-            output = new BufferedOutputStream(socket.getOutputStream(), getDefaultedBufferSize());
+            output = new BufferedOutputStream(socket.getOutputStream(), getBufferSize());
         }
 
         CSL csl = null;
@@ -643,7 +643,7 @@ implements Configurable
         // Treat everything else as binary for now
         try
         {
-            Util.copyStream(local, output, getDefaultedBufferSize(),
+            Util.copyStream(local, output, getBufferSize(),
                     CopyStreamEvent.UNKNOWN_STREAM_SIZE, __mergeListeners(csl),
                     false);
         }
@@ -693,8 +693,7 @@ implements Configurable
             // programmer if possible.  Programmers can decide on their
             // own if they want to wrap the SocketOutputStream we return
             // for file types other than ASCII.
-            output = new BufferedOutputStream(output,
-                    getDefaultedBufferSize());
+            output = new BufferedOutputStream(output, getBufferSize());
             output = new ToNetASCIIOutputStream(output);
 
         }
@@ -1836,9 +1835,9 @@ implements Configurable
         InputStream input;
         if (__fileType == ASCII_FILE_TYPE) {
             input = new FromNetASCIIInputStream(
-                    new BufferedInputStream(socket.getInputStream(), getDefaultedBufferSize()));
+                    new BufferedInputStream(socket.getInputStream(), getBufferSize()));
         } else {
-            input = new BufferedInputStream(socket.getInputStream(), getDefaultedBufferSize());
+            input = new BufferedInputStream(socket.getInputStream(), getBufferSize());
         }
 
         CSL csl = null;
@@ -1849,7 +1848,7 @@ implements Configurable
         // Treat everything else as binary for now
         try
         {
-            Util.copyStream(input, local, getDefaultedBufferSize(),
+            Util.copyStream(input, local, getBufferSize(),
                     CopyStreamEvent.UNKNOWN_STREAM_SIZE, __mergeListeners(csl),
                     false);
         } finally {
@@ -1917,8 +1916,7 @@ implements Configurable
             // programmer if possible.  Programmers can decide on their
             // own if they want to wrap the SocketInputStream we return
             // for file types other than ASCII.
-            input = new BufferedInputStream(input,
-                    getDefaultedBufferSize());
+            input = new BufferedInputStream(input, getBufferSize());
             input = new FromNetASCIIInputStream(input);
         }
         return new org.apache.commons.net.io.SocketInputStream(socket, input);
@@ -3439,14 +3437,6 @@ implements Configurable
     }
 
     /**
-     * Get the buffer size, with default set to Util.DEFAULT_COPY_BUFFER_SIZE.
-     * @return the buffer size.
-     */
-    private int getDefaultedBufferSize() {
-        return __bufferSize > 0 ? __bufferSize : Util.DEFAULT_COPY_BUFFER_SIZE;
-    }
-
-    /**
      * Implementation of the {@link Configurable Configurable} interface.
      * In the case of this class, configuring merely makes the config object available for the
      * factory methods that construct parsers.