亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ftpclient.java

?? 一個利用Java語言實現的ftp程序
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
        		if (issueCommand(portCmd) == FTP_ERROR) {
          			e = new FtpProtocolException("PORT");
          			throw e;
        		}

        		if (issueCommand(cmd) == FTP_ERROR) {
          			e = new FtpProtocolException(cmd);
          			throw e;
        		}
        		dataSocket = portSocket.accept();
      		}
      		finally {
        		if(portSocket != null)
          		portSocket.close();
      		}

      		dataSocket = portSocket.accept();
      		portSocket.close();
	   }//end of port transfer

        return dataSocket;     // return the dataSocket
    }


    /** open a FTP connection to host <i>host</i>. */
    public void openServer(String host) throws IOException, UnknownHostException {
        int port = FTP_PORT;
        if (serverSocket != null)
            closeServer(); 
        serverSocket = new Socket(host, FTP_PORT);    
        serverOutput = new PrintWriter(new BufferedOutputStream(serverSocket.getOutputStream()),true);
        serverInput = new BufferedInputStream(serverSocket.getInputStream());
    }

    /** open a FTP connection to host <i>host</i> on port <i>port</i>. */
    public void openServer(String host, int port) throws IOException, UnknownHostException {
        if (serverSocket != null)
            closeServer();
        serverSocket = new Socket(host, port);
        //serverSocket.setSoLinger(true,30000);
        serverOutput = new PrintWriter(new BufferedOutputStream(serverSocket.getOutputStream()),
                                       true);
        serverInput = new BufferedInputStream(serverSocket.getInputStream());

        if (readReply() == FTP_ERROR)
            throw new FtpConnectException("Welcome message");
    }


    /** 
     * login user to a host with username <i>user</i> and password 
     * <i>password</i> 
     */
    public void login(String user, String password) throws IOException {
       
        if (!serverIsOpen())
            throw new FtpLoginException("Error: not connected to host.\n");
        this.user = user;
        this.password = password;
        if (issueCommand("USER " + user) == FTP_ERROR)
            throw new FtpLoginException("Error: User not found.\n");
        if (password != null && issueCommand("PASS " + password) == FTP_ERROR)
            throw new FtpLoginException("Error: Wrong Password.\n");       
    }

    /** 
     * login user to a host with username <i>user</i> and no password 
     * such as HP server which uses the form "<username>/<password>,user.<group>
     */
    public void login(String user) throws IOException {

        if (!serverIsOpen())
            throw new FtpLoginException("not connected to host");
        this.user = user;        
        if (issueCommand("USER " + user) == FTP_ERROR)
            throw new FtpLoginException("Error: Invalid Username.\n");                 
    }

    /** GET a file from the FTP server in Ascii mode*/
    public BufferedReader getAscii(String filename) throws IOException {     
        Socket  s = null;
        try {
            s = openDataConnection("RETR " + filename);
        } catch (FileNotFoundException fileException) {fileException.printStackTrace();}
        return new BufferedReader( new InputStreamReader(s.getInputStream()));          
    }

    /** GET a file from the FTP server in Binary mode*/
    public BufferedInputStream getBinary(String filename) throws IOException {     
        Socket  s = null;
        try {
            s = openDataConnection("RETR " + filename);
        } catch (FileNotFoundException fileException) {fileException.printStackTrace();}
        return new BufferedInputStream(s.getInputStream());          
    }


    /** PUT a file to the FTP server in Ascii mode*/
    public BufferedWriter putAscii(String filename) throws IOException {
        Socket s = openDataConnection("STOR " + filename);
        return new BufferedWriter(new OutputStreamWriter(s.getOutputStream()),4096);
    }
     
    /** PUT a file to the FTP server in Binary mode*/
    public BufferedOutputStream putBinary(String filename) throws IOException {
        Socket s = openDataConnection("STOR " + filename);
        return new BufferedOutputStream(s.getOutputStream());
    }

    /** APPEND (with create) to a file to the FTP server in Ascii mode*/
    public BufferedWriter appendAscii(String filename) throws IOException {
        Socket s = openDataConnection("APPE " + filename);
        return new BufferedWriter(new OutputStreamWriter(s.getOutputStream()),4096);
    }

    /** APPEND (with create) to a file to the FTP server in Binary mode*/
    public BufferedOutputStream appendBinary(String filename) throws IOException {
        Socket s = openDataConnection("APPE " + filename);
        return new BufferedOutputStream(s.getOutputStream());
    }



   /** NLIST files on a remote FTP server */
    public BufferedReader nlist() throws IOException {
        Socket s = openDataConnection("NLST");        
        return new BufferedReader( new InputStreamReader(s.getInputStream()));
    }

    /** LIST files on a remote FTP server */
    public BufferedReader list() throws IOException {
        Socket s = openDataConnection("LIST");        
        return new BufferedReader( new InputStreamReader(s.getInputStream()));
    }

    /** CD to a specific directory on a remote FTP server */
    public void cd(String remoteDirectory) throws IOException {
        issueCommandCheck("CWD " + remoteDirectory);
    }

    /** Rename a file on the remote server */
    public void rename(String oldFile, String newFile) throws IOException {
         issueCommandCheck("RNFR " + oldFile);
         issueCommandCheck("RNTO " + newFile);
    }
      
    /** Site Command */ 
    public void site(String params) throws IOException {
         issueCommandCheck("SITE "+ params);
    }            
	
    /** Set transfer type to 'I' */
    public void binary() throws IOException {
        issueCommandCheck("TYPE I");
        binaryMode = true;
    }

    /** Set transfer type to 'A' */
    public void ascii() throws IOException {
        issueCommandCheck("TYPE A");
        binaryMode = false;
    }

    /** Send Abort command */
    public void abort() throws IOException {
        issueCommandCheck("ABOR");
    }

    /** Go up one directory on remots system */
    public void cdup() throws IOException {
        issueCommandCheck("CDUP");
    }

    /** Create a directory on the remote system */
    public void mkdir(String s) throws IOException {
        issueCommandCheck("MKD " + s);
    }

    /** Delete the specified directory from the ftp file system */
    public void rmdir(String s) throws IOException {
        issueCommandCheck("RMD " + s);
    }

    /** Delete the file s from the ftp file system */
    public void delete(String s) throws IOException {
        issueCommandCheck("DELE " + s);
    }

    /** Get the name of the present working directory on the ftp file system */
    public void pwd() throws IOException {
        issueCommandCheck("PWD");
    }
    
    /** Retrieve the system type from the remote server */
    public void syst() throws IOException {
        issueCommandCheck("SYST");
    }


    /** New FTP client connected to host <i>host</i>. */
    public FtpClient(String host) throws IOException {      
        openServer(host, FTP_PORT);      
    }

    /** New FTP client connected to host <i>host</i>, port <i>port</i>. */
    public FtpClient(String host, int port) throws IOException {
        openServer(host, port);
    }
    
    /** Method to demonstrate use of FtpClient class */

    public static void main (String args []) throws IOException{
      System.out.println("Demo of FtpClient class.\n");

      // standard login procedures, must be done on all ftp servers 

//      FtpClient f = new FtpClient("ftp.sun.com");
	FtpClient f = new FtpClient("211.69.193.8");

      System.out.print(f.getResponseString());

//      f.login("anonymous","me@abc.com");
	f.login("biogrid", "bio2004");
      System.out.print(f.getResponseString());
                        
      f.pwd(); 
      System.out.println(f.command);                  
      System.out.print(f.getResponseString());

      f.setPassive(true);

      // here's how you can do a listing

      System.out.println("\nDemo of nlist() function");

      f.ascii();  // set client to ascii mode to get text listing   
      System.out.println(f.command);              
      System.out.print(f.getResponseString());
          
      BufferedReader t = f.nlist();     // f.list gives a few more details
      System.out.println(f.command);
      System.out.print(f.getResponseString());  
      while( true ) {
         String stringBuffer = t.readLine();
         if( stringBuffer == null ) break;
         else System.out.println(stringBuffer);               
      }
      t.close();
      System.out.print(f.getResponseString());  
      // here's how to get a file using the getAscii() function.  The getBinary() function is similar in use  
      
      System.out.println("\nDemo of getAscii() function");

      f.ascii();           //  set transfer mode to ASCII, it has to be done by the user.
      System.out.println(f.command);
      System.out.print(f.getResponseString());  
      /*BufferedReader bufGet = f.getAscii("welcome.msg");
      System.out.println(f.command);      
      System.out.print(f.getResponseString());      
      PrintWriter pOut = new PrintWriter(new BufferedWriter(new FileWriter("welcome.msg")));
      int i;                                
      char c[] = new char[4096];
      while ((i = bufGet.read(c)) != -1) 
        pOut.write(c,0,i);                                                   
      bufGet.close();
      pOut.close();            
      */  
      System.out.print(f.getResponseString());     

      
      // here's how to APPEND an ASCII file using the appendAscii() function.  The appendBinary() function
      // is similar in use.  I am leaving this code commented out because you can't send files to the 
      // sun ftp site but you can try this on another ftp server
    
	/*
      System.out.println("\nDemo of appendAscii() function");
      BufferedWriter bufAppe;
      String localFile = "file name goes here"; 
      f.ascii();
      System.out.println(f.command);
      try {
      bufAppe = f.appendAscii(localFile);
      System.out.println(f.command);
      System.out.print(f.getResponseString());     
      
	FileReader fIn = new FileReader(localFile);            
      BufferedReader bufIn = new BufferedReader(fIn);
      int k;
      char b[] = new char[1024];
      while ((k = bufIn.read(b)) != -1) 
        bufAppe.write(b,0,k);                                  
      bufIn.close();
      bufAppe.flush();
      bufAppe.close();                 
      }catch(Exception appendErr) {
         System.out.println(appendErr.toString());//printStackTrace();
         
        }

      System.out.print(f.getResponseString()); 
	


      // here's how to send a binary file using the putBianary() function.  The putAscii() function
      // is similar in use.  I am leaving this code commented out because you can't send files to the 
      // sun ftp site but you can try this on another ftp server
    

      System.out.println("\nDemo of putBinary() function");
 
      String localFile = "file name goes here"; 
      f.binary();
      System.out.println(f.command);
      BufferedOutputStream bufPut = f.putBinary(localFile);
      System.out.println(f.command);
      System.out.print(f.getResponseString());     
      BufferedInputStream bufIn = new BufferedInputStream(new FileInputStream(localFile));
      int j;
      byte b[] = new byte[1024];
      while ((j = bufIn.read(b)) != -1) 
        bufPut.write(b,0,j);                                  
      bufIn.close();
      bufPut.flush();
      bufPut.close();                 

      System.out.print(f.getResponseString()); 
*/
      // close the connection

      f.closeServer();
      System.out.println(f.command);
      System.out.print(f.getResponseString());
    }


}

class FtpLoginException extends FtpProtocolException {
    FtpLoginException(String s) {
        super(s);
    }
}
class FtpConnectException extends FtpProtocolException {
    FtpConnectException(String s) {
        super(s);
    }
}

class FtpProtocolException extends IOException {
    FtpProtocolException(String s) {
        super(s);     
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
eeuss国产一区二区三区| 亚洲超碰精品一区二区| 日韩免费一区二区三区在线播放| 色哟哟亚洲精品| 91玉足脚交白嫩脚丫在线播放| 国产精品资源在线观看| 色偷偷一区二区三区| 9i在线看片成人免费| www.视频一区| 日本韩国欧美国产| 欧美日韩免费高清一区色橹橹| 欧美自拍偷拍午夜视频| 欧美日韩五月天| 91精品国产综合久久久蜜臀粉嫩| 精品国精品国产| 国产精品欧美综合在线| 自拍视频在线观看一区二区| 粉嫩一区二区三区性色av| 成人午夜伦理影院| 一本一本大道香蕉久在线精品| 欧美三级在线视频| 欧美大度的电影原声| 国产女主播视频一区二区| 中文字幕一区二区在线观看| 一区二区三区高清| 老司机精品视频在线| 粉嫩绯色av一区二区在线观看| 精品粉嫩aⅴ一区二区三区四区 | 中文字幕在线播放不卡一区| 中日韩av电影| 一区二区三区欧美久久| 日韩精品视频网| 成人午夜视频网站| 91精品国产综合久久精品| 久久久精品免费观看| 亚洲一区二区在线视频| 国产传媒久久文化传媒| 亚洲国产精品成人久久综合一区| 夜色激情一区二区| 国产一区二区网址| 欧美色视频在线观看| 久久久国产精品不卡| 首页国产丝袜综合| 97久久超碰国产精品| 欧美一区二区三区免费在线看| 国产精品福利一区| 免费欧美在线视频| 欧美日免费三级在线| 人人精品人人爱| 99精品国产99久久久久久白柏| 欧美电影一区二区| 亚洲天堂精品在线观看| 国产毛片精品视频| 欧美一区二区日韩一区二区| 成人欧美一区二区三区视频网页 | 成人久久久精品乱码一区二区三区| 欧美这里有精品| 美女视频黄免费的久久| 在线看不卡av| 亚洲视频一区二区在线观看| 国产精品影视在线| 精品免费日韩av| 免费成人在线影院| 欧美日韩综合在线| 亚洲国产中文字幕| 欧美日韩综合一区| 午夜影院在线观看欧美| 欧美在线观看视频一区二区 | 偷偷要91色婷婷| 欧美日韩一区小说| 亚洲一区在线播放| 欧美日韩一区二区三区视频| 亚洲综合男人的天堂| 日本精品视频一区二区| 亚洲伦理在线精品| 在线观看日韩电影| 亚洲一区在线视频| 亚洲色图另类专区| 一本到高清视频免费精品| 亚洲欧美成人一区二区三区| 97久久精品人人做人人爽| 亚洲精品视频一区| 欧美伊人精品成人久久综合97 | 色偷偷久久人人79超碰人人澡| 国产精品福利电影一区二区三区四区 | 国产一区二区调教| 中文字幕欧美国产| 91在线国内视频| 一区二区三区中文字幕| 欧美日韩高清在线| 蜜臀av性久久久久蜜臀av麻豆| 日韩午夜中文字幕| 国产精品888| 亚洲欧美aⅴ...| 91麻豆精品国产91久久久久久久久 | 久久久久高清精品| 99精品国产视频| 天堂久久一区二区三区| 久久青草欧美一区二区三区| 成人高清视频在线| 午夜日韩在线观看| 久久久国产精华| 欧美日韩在线精品一区二区三区激情 | 日韩激情视频网站| 国产午夜亚洲精品不卡| 91浏览器入口在线观看| 麻豆精品国产传媒mv男同| 国产精品人妖ts系列视频| 色综合一区二区| 蜜桃视频在线观看一区二区| 国产精品久久久久久久久搜平片 | 99riav久久精品riav| 五月婷婷色综合| 欧美高清一级片在线观看| 欧美美女一区二区在线观看| 国产成人精品免费一区二区| 亚洲国产日韩av| 欧美韩国日本不卡| 日韩三区在线观看| 在线视频欧美区| 成人h动漫精品| 欧美三级一区二区| 粉嫩绯色av一区二区在线观看 | 日韩欧美黄色影院| 色婷婷精品大视频在线蜜桃视频| 九九视频精品免费| 天堂久久一区二区三区| 夜夜揉揉日日人人青青一国产精品 | 韩国成人福利片在线播放| 图片区小说区国产精品视频| 久久国产精品区| 日日嗨av一区二区三区四区| 亚洲欧洲综合另类在线| 国产欧美精品区一区二区三区 | 国产一区二区91| 青青草国产成人av片免费| 一区二区三区四区乱视频| 337p日本欧洲亚洲大胆精品 | 色综合激情五月| 99视频国产精品| 精品国产制服丝袜高跟| 欧美精品日韩一区| 欧美日韩一区二区在线观看| 不卡的av中国片| thepron国产精品| 成人av网址在线| 成人av资源在线| 91在线免费播放| 色94色欧美sute亚洲13| 一本到不卡免费一区二区| 色哟哟一区二区三区| 日本韩国欧美国产| 欧美性一区二区| 欧美剧在线免费观看网站| 国产精品久久久久桃色tv| 国产精品久久久久四虎| 亚洲乱码国产乱码精品精可以看| 亚洲精品高清在线| 亚洲福利视频一区二区| 亚洲国产成人91porn| 日本91福利区| 国产一级精品在线| voyeur盗摄精品| 欧美午夜在线观看| 欧美精品久久一区二区三区| 日韩一级片在线观看| 久久精品在这里| 亚洲视频免费观看| 国产毛片精品国产一区二区三区| 国产91在线|亚洲| 99久久婷婷国产精品综合| 91美女片黄在线观看91美女| 欧美日韩视频第一区| 精品卡一卡二卡三卡四在线| 国产精品久久久久桃色tv| 一区二区三区在线影院| 老司机一区二区| 99久久亚洲一区二区三区青草| 欧美日韩国产一级二级| 欧美精品一区二区高清在线观看| 欧美国产日韩在线观看| 亚洲国产欧美日韩另类综合| 欧美日韩免费高清一区色橹橹| 精品国产一区久久| 亚洲女子a中天字幕| 久久99深爱久久99精品| 91在线国产福利| 26uuu色噜噜精品一区二区| 一区二区三区在线免费| 精品一区二区三区香蕉蜜桃 | 国产清纯白嫩初高生在线观看91| 亚洲已满18点击进入久久| 精品亚洲porn| 欧美午夜影院一区| 免费观看一级特黄欧美大片| 国产又粗又猛又爽又黄91精品| 色噜噜偷拍精品综合在线| 久久久久久久久久久电影| 香蕉成人伊视频在线观看| 99久久婷婷国产|