commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r645995 - in /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net: ftp/FTPClient.java io/FromNetASCIIInputStream.java
Date Tue, 08 Apr 2008 16:46:00 GMT
Author: sebb
Date: Tue Apr  8 09:45:59 2008
New Revision: 645995

URL: http://svn.apache.org/viewvc?rev=645995&view=rev
Log:
NET-213 - use default encoding for getting line.separator bytes

Modified:
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/FromNetASCIIInputStream.java

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=645995&r1=645994&r2=645995&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Tue Apr  8 09:45:59 2008
@@ -1279,7 +1279,7 @@
         input = new BufferedInputStream(socket.getInputStream(),
                                         getBufferSize());
         if (__fileType == ASCII_FILE_TYPE)
-          input = new FromNetASCIIInputStream(input, getControlEncoding());
+          input = new FromNetASCIIInputStream(input);
         // Treat everything else as binary for now
         try
         {
@@ -1344,7 +1344,7 @@
           // for file types other than ASCII.
           input = new BufferedInputStream(input,
                                           getBufferSize());
-          input = new FromNetASCIIInputStream(input, getControlEncoding());
+          input = new FromNetASCIIInputStream(input);
         }
         return new org.apache.commons.net.io.SocketInputStream(socket, input);
     }

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/FromNetASCIIInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/FromNetASCIIInputStream.java?rev=645995&r1=645994&r2=645995&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/FromNetASCIIInputStream.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/FromNetASCIIInputStream.java
Tue Apr  8 09:45:59 2008
@@ -20,8 +20,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PushbackInputStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
 
 /***
  * This class wraps an input stream, replacing all occurrences
@@ -38,11 +36,12 @@
 {
     static final boolean _noConversionRequired;
     static final String _lineSeparator;
-    static byte[] _lineSeparatorBytes;
+    static final byte[] _lineSeparatorBytes;
 
     static {
         _lineSeparator = System.getProperty("line.separator");
         _noConversionRequired = _lineSeparator.equals("\r\n");
+        _lineSeparatorBytes = _lineSeparator.getBytes();
     }
 
     private int __length = 0;
@@ -64,28 +63,13 @@
     /***
      * Creates a FromNetASCIIInputStream instance that wraps an existing
      * InputStream.
-     * @param input The {@link InputStream} instance
-     * @param encoding A character set encoding specifier
-     * 
-     * @throws UnsupportedEncodingException 
      ***/
-    public FromNetASCIIInputStream(InputStream input, String encoding) throws UnsupportedEncodingException
+    public FromNetASCIIInputStream(InputStream input)
     {
         super(input, _lineSeparatorBytes.length + 1);
-        _lineSeparatorBytes = _lineSeparator.getBytes(encoding); 
     }
-    
-    /**
-     * Creates a FromNetASCIIInputStream instance that wraps an existing
-     * InputStream.
-     * @param input An {@link InputStream} instance
-     * @throws UnsupportedEncodingException
-     */
-    public FromNetASCIIInputStream(InputStream input) throws UnsupportedEncodingException

-    {
-    	this(input, Charset.defaultCharset().name()); 
-    }
-    
+
+
     private int __read() throws IOException
     {
         int ch;



Mime
View raw message