src/share/classes/sun/net/ftp/impl/FtpClient.java
Print this page
@@ -30,22 +30,21 @@
import java.security.PrivilegedAction;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Base64;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.TimeZone;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
-import sun.misc.BASE64Decoder;
-import sun.misc.BASE64Encoder;
import sun.net.ftp.*;
import sun.util.logging.PlatformLogger;
public class FtpClient extends sun.net.ftp.FtpClient {
@@ -1897,26 +1896,20 @@
}
return null;
}
private boolean sendSecurityData(byte[] buf) throws IOException {
- BASE64Encoder encoder = new BASE64Encoder();
- String s = encoder.encode(buf);
+ String s = Base64.getEncoder().encodeToString(buf);
return issueCommand("ADAT " + s);
}
private byte[] getSecurityData() {
String s = getLastResponseString();
if (s.substring(4, 9).equalsIgnoreCase("ADAT=")) {
- BASE64Decoder decoder = new BASE64Decoder();
- try {
// Need to get rid of the leading '315 ADAT='
// and the trailing newline
- return decoder.decodeBuffer(s.substring(9, s.length() - 1));
- } catch (IOException e) {
- //
- }
+ return Base64.getDecoder().decode(s.substring(9, s.length() - 1));
}
return null;
}
/**