home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / sun / net / ftp / IftpClient.class (.txt) < prev   
Encoding:
Java Class File  |  1998-04-23  |  1.7 KB  |  55 lines

  1. package sun.net.ftp;
  2.  
  3. import java.io.IOException;
  4. import sun.net.NetworkClient;
  5.  
  6. public class IftpClient extends FtpClient {
  7.    public static final int IFTP_PORT = 4666;
  8.    String proxyServer = "sun-barr";
  9.    String actualHost;
  10.  
  11.    public void openServer(String var1) throws IOException {
  12.       if (!((NetworkClient)this).serverIsOpen()) {
  13.          super.openServer(this.proxyServer, 4666);
  14.       }
  15.  
  16.       this.actualHost = var1;
  17.    }
  18.  
  19.    boolean checkExpectedReply() throws IOException {
  20.       return ((FtpClient)this).readReply() != FtpClient.FTP_ERROR;
  21.    }
  22.  
  23.    public void login(String var1, String var2) throws IOException {
  24.       if (!((NetworkClient)this).serverIsOpen()) {
  25.          throw new FtpLoginException("not connected to host");
  26.       } else {
  27.          var1 = var1 + "@" + this.actualHost;
  28.          super.user = var1;
  29.          super.password = var2;
  30.          if (((FtpClient)this).issueCommand("USER " + var1) != FtpClient.FTP_ERROR && (super.lastReplyCode != 220 || this.checkExpectedReply())) {
  31.             if (var2 != null && ((FtpClient)this).issueCommand("PASS " + var2) == FtpClient.FTP_ERROR) {
  32.                throw new FtpLoginException("password");
  33.             }
  34.          } else {
  35.             throw new FtpLoginException("user");
  36.          }
  37.       }
  38.    }
  39.  
  40.    public void setProxyServer(String var1) throws IOException {
  41.       if (((NetworkClient)this).serverIsOpen()) {
  42.          ((FtpClient)this).closeServer();
  43.       }
  44.  
  45.       this.proxyServer = var1;
  46.    }
  47.  
  48.    public IftpClient(String var1) throws IOException {
  49.       this.openServer(var1);
  50.    }
  51.  
  52.    public IftpClient() {
  53.    }
  54. }
  55.