We can now use getCharset instead of the name

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/net/trunk@1738430 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/net/SocketClient.java b/src/main/java/org/apache/commons/net/SocketClient.java
index 741a7d0..e23b985 100644
--- a/src/main/java/org/apache/commons/net/SocketClient.java
+++ b/src/main/java/org/apache/commons/net/SocketClient.java
@@ -852,8 +852,9 @@
      *
      * @return the charset.
      * @since 3.3
-     * TODO Will be deprecated once the code requires Java 1.6 as a mininmum
+     * @deprecated Since the code now requires Java 1.6 as a mininmum
      */
+    @Deprecated
     public String getCharsetName() {
         return charset.name();
     }
diff --git a/src/main/java/org/apache/commons/net/bsd/RExecClient.java b/src/main/java/org/apache/commons/net/bsd/RExecClient.java
index 00127b9..7ecf8eb 100644
--- a/src/main/java/org/apache/commons/net/bsd/RExecClient.java
+++ b/src/main/java/org/apache/commons/net/bsd/RExecClient.java
@@ -214,11 +214,11 @@
             _output_.write(NULL_CHAR);
         }
 
-        _output_.write(username.getBytes(getCharsetName())); // Java 1.6 can use getCharset()
+        _output_.write(username.getBytes(getCharset()));
         _output_.write(NULL_CHAR);
-        _output_.write(password.getBytes(getCharsetName())); // Java 1.6 can use getCharset()
+        _output_.write(password.getBytes(getCharset()));
         _output_.write(NULL_CHAR);
-        _output_.write(command.getBytes(getCharsetName())); // Java 1.6 can use getCharset()
+        _output_.write(command.getBytes(getCharset()));
         _output_.write(NULL_CHAR);
         _output_.flush();
 
diff --git a/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java b/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
index 96869f6..0f95708 100644
--- a/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
+++ b/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
@@ -71,7 +71,7 @@
         StringBuilder result = new StringBuilder(__buffer.length);
         BufferedReader reader;
 
-        reader = new BufferedReader(new InputStreamReader(_input_, getCharsetName())); // Java 1.6 can use getCharset()
+        reader = new BufferedReader(new InputStreamReader(_input_, getCharset()));
 
         while (true)
         {
diff --git a/src/main/java/org/apache/commons/net/finger/FingerClient.java b/src/main/java/org/apache/commons/net/finger/FingerClient.java
index 601fe46..f5daf00 100644
--- a/src/main/java/org/apache/commons/net/finger/FingerClient.java
+++ b/src/main/java/org/apache/commons/net/finger/FingerClient.java
@@ -89,7 +89,7 @@
 
         input =
             new BufferedReader(new InputStreamReader(getInputStream(longOutput,
-                               username), getCharsetName())); // Java 1.6 can use getCharset()
+                               username), getCharset()));
 
         try {
             while (true)
diff --git a/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java b/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
index c5ca526..52df2c8 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
@@ -165,7 +165,7 @@
 
         List<String> response = new ArrayList<String>();
         BufferedReader reader = new BufferedReader(
-                new InputStreamReader(input, getCharsetName())); // Java 1.6 can use getCharset()
+                new InputStreamReader(input, getCharset()));
 
         for (String line = reader.readLine(); line != null
         && line.length() > 0; line = reader.readLine()) {
diff --git a/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java b/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
index 55ce3dc..93055d6 100644
--- a/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
+++ b/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
@@ -158,7 +158,7 @@
                 // the server sends an empty response ("+ "), so we don't have to read it.
                 int result = sendData(
                     Base64.encodeBase64StringUnChunked(("\000" + username + "\000" + password)
-                            .getBytes(getCharsetName())));  // Java 1.6 can use getCharset()
+                            .getBytes(getCharset())));
                 if (result == IMAPReply.OK)
                 {
                     setState(IMAP.IMAPState.AUTH_STATE);
@@ -171,12 +171,11 @@
                 byte[] serverChallenge = Base64.decodeBase64(getReplyString().substring(2).trim());
                 // get the Mac instance
                 Mac hmac_md5 = Mac.getInstance("HmacMD5");
-                hmac_md5.init(new SecretKeySpec(password.getBytes(getCharsetName()), "HmacMD5")); // Java 1.6 can use getCharset()
+                hmac_md5.init(new SecretKeySpec(password.getBytes(getCharset()), "HmacMD5"));
                 // compute the result:
-                // Java 1.6 can use getCharset()
-                byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharsetName());
+                byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharset());
                 // join the byte arrays to form the reply
-                byte[] usernameBytes = username.getBytes(getCharsetName()); // Java 1.6 can use getCharset()
+                byte[] usernameBytes = username.getBytes(getCharset());
                 byte[] toEncode = new byte[usernameBytes.length + 1 /* the space */ + hmacResult.length];
                 System.arraycopy(usernameBytes, 0, toEncode, 0, usernameBytes.length);
                 toEncode[usernameBytes.length] = ' ';
@@ -193,14 +192,11 @@
             {
                 // the server sends fixed responses (base64("Username") and
                 // base64("Password")), so we don't have to read them.
-                if (sendData(
-                        // Java 1.6 can use getCharset()
-                    Base64.encodeBase64StringUnChunked(username.getBytes(getCharsetName()))) != IMAPReply.CONT)
+                if (sendData(Base64.encodeBase64StringUnChunked(username.getBytes(getCharset()))) != IMAPReply.CONT)
                 {
                     return false;
                 }
-                // Java 1.6 can use getCharset()
-                int result = sendData(Base64.encodeBase64StringUnChunked(password.getBytes(getCharsetName())));
+                int result = sendData(Base64.encodeBase64StringUnChunked(password.getBytes(getCharset())));
                 if (result == IMAPReply.OK)
                 {
                     setState(IMAP.IMAPState.AUTH_STATE);
diff --git a/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java b/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
index 1abdef8..dd7301e 100644
--- a/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
+++ b/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
@@ -77,20 +77,19 @@
                 // the server sends an empty response ("+ "), so we don't have to read it.
                 return sendCommand(
                     new String(
-                        Base64.encodeBase64(("\000" + username + "\000" + password).getBytes(getCharsetName())),
-                        getCharsetName()) // Java 1.6 can use getCharset()
+                        Base64.encodeBase64(("\000" + username + "\000" + password).getBytes(getCharset())),
+                        getCharset())
                     ) == POP3Reply.OK;
             case CRAM_MD5:
                 // get the CRAM challenge
                 byte[] serverChallenge = Base64.decodeBase64(getReplyString().substring(2).trim());
                 // get the Mac instance
                 Mac hmac_md5 = Mac.getInstance("HmacMD5");
-                hmac_md5.init(new SecretKeySpec(password.getBytes(getCharsetName()), "HmacMD5")); // Java 1.6 can use getCharset()
+                hmac_md5.init(new SecretKeySpec(password.getBytes(getCharset()), "HmacMD5"));
                 // compute the result:
-                // Java 1.6 can use getCharset()
-                byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharsetName());
+                byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharset());
                 // join the byte arrays to form the reply
-                byte[] usernameBytes = username.getBytes(getCharsetName()); // Java 1.6 can use getCharset()
+                byte[] usernameBytes = username.getBytes(getCharset());
                 byte[] toEncode = new byte[usernameBytes.length + 1 /* the space */ + hmacResult.length];
                 System.arraycopy(usernameBytes, 0, toEncode, 0, usernameBytes.length);
                 toEncode[usernameBytes.length] = ' ';
diff --git a/src/main/java/org/apache/commons/net/pop3/POP3Client.java b/src/main/java/org/apache/commons/net/pop3/POP3Client.java
index 822a97f..21a399e 100644
--- a/src/main/java/org/apache/commons/net/pop3/POP3Client.java
+++ b/src/main/java/org/apache/commons/net/pop3/POP3Client.java
@@ -214,7 +214,7 @@
 
         md5 = MessageDigest.getInstance("MD5");
         timestamp += secret;
-        digest = md5.digest(timestamp.getBytes(getCharsetName())); // Java 1.6 can use getCharset()
+        digest = md5.digest(timestamp.getBytes(getCharset()));
         digestBuffer = new StringBuilder(128);
 
         for (i = 0; i < digest.length; i++) {
diff --git a/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java b/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
index 08c8f5c..e3a9376 100644
--- a/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
+++ b/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
@@ -224,8 +224,7 @@
         {
             // the server sends an empty response ("334 "), so we don't have to read it.
             return SMTPReply.isPositiveCompletion(sendCommand(
-                    // Java 1.6 can use getCharset()
-                    Base64.encodeBase64StringUnChunked(("\000" + username + "\000" + password).getBytes(getCharsetName()))
+                    Base64.encodeBase64StringUnChunked(("\000" + username + "\000" + password).getBytes(getCharset()))
                 ));
         }
         else if (method.equals(AUTH_METHOD.CRAM_MD5))
@@ -234,12 +233,11 @@
             byte[] serverChallenge = Base64.decodeBase64(getReplyString().substring(4).trim());
             // get the Mac instance
             Mac hmac_md5 = Mac.getInstance("HmacMD5");
-            hmac_md5.init(new SecretKeySpec(password.getBytes(getCharsetName()), "HmacMD5")); // Java 1.6 can use getCharset()
+            hmac_md5.init(new SecretKeySpec(password.getBytes(getCharset()), "HmacMD5"));
             // compute the result:
-            // Java 1.6 can use getCharset()
-            byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharsetName());
+            byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharset());
             // join the byte arrays to form the reply
-            byte[] usernameBytes = username.getBytes(getCharsetName()); // Java 1.6 can use getCharset()
+            byte[] usernameBytes = username.getBytes(getCharset());
             byte[] toEncode = new byte[usernameBytes.length + 1 /* the space */ + hmacResult.length];
             System.arraycopy(usernameBytes, 0, toEncode, 0, usernameBytes.length);
             toEncode[usernameBytes.length] = ' ';
@@ -253,16 +251,16 @@
             // the server sends fixed responses (base64("Username") and
             // base64("Password")), so we don't have to read them.
             if (!SMTPReply.isPositiveIntermediate(sendCommand(
-                Base64.encodeBase64StringUnChunked(username.getBytes(getCharsetName()))))) { // Java 1.6 can use getCharset()
+                Base64.encodeBase64StringUnChunked(username.getBytes(getCharset()))))) {
                 return false;
             }
             return SMTPReply.isPositiveCompletion(sendCommand(
-                Base64.encodeBase64StringUnChunked(password.getBytes(getCharsetName())))); // Java 1.6 can use getCharset()
+                Base64.encodeBase64StringUnChunked(password.getBytes(getCharset()))));
         }
         else if (method.equals(AUTH_METHOD.XOAUTH))
         {
             return SMTPReply.isPositiveIntermediate(sendCommand(
-                    Base64.encodeBase64StringUnChunked(username.getBytes(getCharsetName())) // Java 1.6 can use getCharset()
+                    Base64.encodeBase64StringUnChunked(username.getBytes(getCharset()))
             ));
         } else {
             return false; // safety check
diff --git a/src/main/java/org/apache/commons/net/telnet/Telnet.java b/src/main/java/org/apache/commons/net/telnet/Telnet.java
index ed01f33..c66f891 100644
--- a/src/main/java/org/apache/commons/net/telnet/Telnet.java
+++ b/src/main/java/org/apache/commons/net/telnet/Telnet.java
@@ -741,7 +741,7 @@
         {
             _output_.write(_COMMAND_SB);
             _output_.write(_COMMAND_IS);
-            _output_.write(terminalType.getBytes(getCharsetName())); // Java 1.6 can use getCharset()
+            _output_.write(terminalType.getBytes(getCharset()));
             _output_.write(_COMMAND_SE);
             _output_.flush();
         }