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

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

?? ftpconnection.java

?? 一個利用Java語言實現的ftp程序
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
         try {
             clientAddr = InetAddress.getByName(dataSrvName);
         }
         catch(UnknownHostException ex) {
             out.write(mFtpStatus.getResponse(553, request, mUser, null));
             return;
         }
         
         // get data server port
         int clientPort = 0;
         try {
             int hi = Integer.parseInt(st.nextToken());
             int lo = Integer.parseInt(st.nextToken());
             clientPort = (hi << 8) | lo;     
         }
         catch(NumberFormatException ex) {
            out.write(mFtpStatus.getResponse(552, request, mUser, null)); 
            return; 
         }
         
         mDataConnection.setPortCommand(clientAddr, clientPort);
         out.write(mFtpStatus.getResponse(200, request, mUser, null));
     }
     
     
     /**
      * <code>PWD  &lt;CRLF&gt;</code><br>
      *
      * This command causes the name of the current working
      * directory to be returned in the reply.
      */
     public void doPWD(FtpRequest request, FtpWriter out) throws IOException {
         resetState();
         String args[] = {mUser.getVirtualDirectory().getCurrentDirectory()};
         out.write(mFtpStatus.getResponse(257, request, mUser, args));
     }
     
     
     /**
      * <code>QUIT &lt;CRLF&gt;</code><br>
      *
      * This command terminates a USER and if file transfer is not
      * in progress, the server closes the control connection.
      */
     public void doQUIT(FtpRequest request, FtpWriter out) throws IOException {
        resetState();
        out.write(mFtpStatus.getResponse(221, request, mUser, null));
        ConnectionService conService = mConfig.getConnectionService();
        if (conService != null) {
            conService.closeConnection(mUser.getSessionId());
        }
     }
     
     
     /**
      * <code>REST &lt;SP&gt; <marker> &lt;CRLF&gt;</code><br>
      *
      * The argument field represents the server marker at which
      * file transfer is to be restarted.  This command does not
      * cause file transfer but skips over the file to the specified
      * data checkpoint.  This command shall be immediately followed
      * by the appropriate FTP service command which shall cause
      * file transfer to resume.
      */
     public void doREST(FtpRequest request, FtpWriter out) throws IOException {
         
         // argument check
         if(!request.hasArgument()) {
            out.write(mFtpStatus.getResponse(501, request, mUser, null));
            return;  
         }
       
         resetState();
         mlSkipLen = 0;
         String skipNum = request.getArgument();
         try { 
              mlSkipLen = Long.parseLong(skipNum);
         }
         catch(NumberFormatException ex) {
             out.write(mFtpStatus.getResponse(501, request, mUser, null)); 
             return;
         }
         if(mlSkipLen < 0) {
             mlSkipLen = 0;
             out.write(mFtpStatus.getResponse(501, request, mUser, null));
             return;
         }
         mbReset = true;
         out.write(mFtpStatus.getResponse(350, request, mUser, null));
     } 
     
     
     /**
      * <code>RETR &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;</code><br>
      *
      * This command causes the server-DTP to transfer a copy of the
      * file, specified in the pathname, to the server- or user-DTP
      * at the other end of the data connection.  The status and
      * contents of the file at the server site shall be unaffected.
      */
     public void doRETR(FtpRequest request, FtpWriter out) throws IOException {
        
         InputStream is = null;
         OutputStream os = null;
         try {
                     
             // set state variables
             long skipLen = (mbReset) ? mlSkipLen : 0;
             resetState();
             
             // argument check
             if(!request.hasArgument()) {
                out.write(mFtpStatus.getResponse(501, request, mUser, null));
                return;  
             }
             
             // get filename
             String fileName = request.getArgument();
             fileName = mUser.getVirtualDirectory().getAbsoluteName(fileName);
             String physicalName = mUser.getVirtualDirectory().getPhysicalName(fileName);
             File requestedFile = new File(physicalName);
             String args[] = {fileName};
             
             // check file existance
             if( !(requestedFile.exists() && requestedFile.isFile()) ) {
                 out.write(mFtpStatus.getResponse(550, request, mUser, args));
                 return;
             }
             
             // check permission
             if(!mUser.getVirtualDirectory().hasReadPermission(physicalName, true)) {
                 out.write(mFtpStatus.getResponse(550, request, mUser, args));
                 return;
             }
             
             // now transfer file data
             out.write(mFtpStatus.getResponse(150, request, mUser, null));
             Socket dataSoc = mDataConnection.getDataSocket();
             if (dataSoc == null) {
                  out.write(mFtpStatus.getResponse(550, request, mUser, args));
                  return;
             }
             
             os = mUser.getOutputStream(dataSoc.getOutputStream());
             
             // move to the appropriate offset
             RandomAccessFile raf = new RandomAccessFile(requestedFile, "r");
             raf.seek(skipLen);
             is = new FileInputStream(raf.getFD());                 
              
              
             // send file data to client
             StreamConnector msc = new StreamConnector(is, os);
             msc.setMaxTransferRate(mUser.getMaxDownloadRate());
             msc.setObserver(this);
             msc.connect();  
             
             if(msc.hasException()) {
                 out.write(mFtpStatus.getResponse(451, request, mUser, args));
                 return;
             }
             else {
                 mConfig.getStatistics().setDownload(requestedFile, mUser, msc.getTransferredSize());
             }
            
             out.write(mFtpStatus.getResponse(226, request, mUser, null));   
         }
         catch(IOException ex) {
             out.write(mFtpStatus.getResponse(425, request, mUser, null));
         }
         finally {
             IoUtils.close(is);
             IoUtils.close(os);
             mDataConnection.closeDataSocket();
         }
     }
     
     
     /**
      * <code>RMD  &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;</code><br>
      *
      * This command causes the directory specified in the pathname
      * to be removed as a directory (if the pathname is absolute)
      * or as a subdirectory of the current working directory (if
      * the pathname is relative).
      */
     public void doRMD(FtpRequest request, FtpWriter out) throws IOException {
        
        // reset state variables
        resetState(); 
         
        // argument check
        if(!request.hasArgument()) {
            out.write(mFtpStatus.getResponse(501, request, mUser, null));
            return;  
        }
        
        // get file names
        String fileName = request.getArgument();
        fileName = mUser.getVirtualDirectory().getAbsoluteName(fileName);
        String physicalName = mUser.getVirtualDirectory().getPhysicalName(fileName);
        File requestedFile = new File(physicalName);
        String args[] = {fileName};
        
        // check permission
        if(!mUser.getVirtualDirectory().hasWritePermission(physicalName, true)) {
            out.write(mFtpStatus.getResponse(450, request, mUser, args));
            return;
        }
        
        // now delete
        if(requestedFile.delete()) {
           out.write(mFtpStatus.getResponse(250, request, mUser, args)); 
        }
        else {
           out.write(mFtpStatus.getResponse(450, request, mUser, args));
        }
     }
     
     
     /**
      * <code>RNFR &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;</code><br>
      *
      * This command specifies the old pathname of the file which is
      * to be renamed.  This command must be immediately followed by
      * a "rename to" command specifying the new file pathname.
      */
     public void doRNFR(FtpRequest request, FtpWriter out) throws IOException {
         
         // reset state variable
         resetState();
         
         // argument check
         if(!request.hasArgument()) {
            out.write(mFtpStatus.getResponse(501, request, mUser, null));
            return;  
         }
         
         // set state variable
         mbRenFr = true;
         
         // get filename
         String fileName = request.getArgument();
         fileName = mUser.getVirtualDirectory().getAbsoluteName(fileName);
         mstRenFr = mUser.getVirtualDirectory().getPhysicalName(fileName);
         String args[] = {fileName};
         
         out.write(mFtpStatus.getResponse(350, request, mUser, args));
     }
     
     
     /**
      * <code>RNTO &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;</code><br>
      *
      * This command specifies the new pathname of the file
      * specified in the immediately preceding "rename from"
      * command.  Together the two commands cause a file to be
      * renamed.
      */
     public void doRNTO(FtpRequest request, FtpWriter out) throws IOException {
         
         // argument check
         if(!request.hasArgument()) {
            resetState(); 
            out.write(mFtpStatus.getResponse(501, request, mUser, null));
            return;  
         }
         
         // set state variables
         if((!mbRenFr) || (mstRenFr == null)) {
              resetState();
              out.write(mFtpStatus.getResponse(100, request, mUser, null));
              return;
         }
         
         // get filenames
         String fromFileStr = mUser.getVirtualDirectory().getVirtualName(mstRenFr);
         String toFileStr = request.getArgument();
         toFileStr = mUser.getVirtualDirectory().getAbsoluteName(toFileStr);
         String physicalToFileStr = mUser.getVirtualDirectory().getPhysicalName(toFileStr);
         File fromFile = new File(mstRenFr);
         File toFile = new File(physicalToFileStr);
         String args[] = {fromFileStr, toFileStr};
         
         resetState();
         
         // check permission
         if(!mUser.getVirtualDirectory().hasCreatePermission(physicalToFileStr, true)) {
            out.write(mFtpStatus.getResponse(553, request, mUser, null));
            return;
         }
         
         // now rename
         if(fromFile.renameTo(toFile)) {
             out.write(mFtpStatus.getResponse(250, request, mUser, args));
         }
         else {
             out.write(mFtpStatus.getResponse(553, request, mUser, args));
         }
     } 
     
     
     /**
      * <code>SITE &lt;SP&gt; <string> &lt;CRLF&gt;</code><br>
      *
      * This command is used by the server to provide services
      * specific to his system that are essential to file transfer
      * but not sufficiently universal to be included as commands in
      * the protocol.
      */
     public void doSITE(FtpRequest request, FtpWriter out) throws IOException {
         resetState();
         SiteCommandHandler siteCmd = new SiteCommandHandler( mConfig, mUser );
         out.write( siteCmd.getResponse(request) );
     }
     
     
     /**
      * <code>SIZE &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;</code><br>
      *
      * Returns the size of the file in bytes.
      */
     public void doSIZE(FtpRequest request, FtpWriter out) throws IOException {
         

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区欧美在线观看| 亚洲一二三四在线| 国产精品99久久久久久久女警| 久久综合九色欧美综合狠狠| 国产精品538一区二区在线| 亚洲三级在线观看| 精品少妇一区二区三区免费观看| 成人免费视频一区二区| 日韩精品午夜视频| 亚洲视频一二区| 欧美精品一区二区在线播放| 9久草视频在线视频精品| 久热成人在线视频| 亚洲人成在线播放网站岛国| 91麻豆精品国产91久久久久| 豆国产96在线|亚洲| 精品一区精品二区高清| 天堂一区二区在线| 亚洲人成电影网站色mp4| 国产欧美一区二区精品婷婷 | 欧美一级午夜免费电影| 91污片在线观看| 成人av免费在线| 欧美剧情电影在线观看完整版免费励志电影| 久久精品国产亚洲aⅴ| 亚洲一卡二卡三卡四卡| 一区二区三区不卡视频| 国产精品国产三级国产aⅴ无密码| 日韩免费看的电影| 国产亚洲精品资源在线26u| 2023国产精华国产精品| 91精品欧美一区二区三区综合在 | 一区二区三区在线视频播放 | 国产精品久久久久久久久免费樱桃| 26uuu国产一区二区三区| 亚洲精品在线电影| 国产欧美精品日韩区二区麻豆天美| 亚洲欧美自拍偷拍色图| 亚洲女性喷水在线观看一区| 亚洲色欲色欲www| 性感美女久久精品| 久久精品国产色蜜蜜麻豆| 亚洲福利视频导航| 久久精品99国产精品| 粉嫩一区二区三区在线看| 欧美日韩免费观看一区三区| 精品奇米国产一区二区三区| 国产精品午夜春色av| 亚洲国产综合人成综合网站| 国产呦萝稀缺另类资源| 在线免费不卡视频| 国产亚洲综合av| 久久99国产精品麻豆| 欧美在线观看一区二区| 国产精品第一页第二页第三页| 天天综合天天做天天综合| 国产一区二区三区精品视频| 91九色最新地址| 1024国产精品| 国产乱码精品一区二区三区av| 色噜噜狠狠色综合欧洲selulu| 精品成人私密视频| 亚洲福中文字幕伊人影院| 91亚洲永久精品| 亚洲欧洲中文日韩久久av乱码| 国产福利91精品| 国产精品网曝门| 粉嫩av一区二区三区在线播放| 精品国产乱码久久久久久久 | 日韩欧美一二区| 午夜亚洲福利老司机| 精品三级av在线| 国产经典欧美精品| 久久久久久免费毛片精品| 精品一区二区综合| 国产精品女同一区二区三区| 在线视频你懂得一区| 亚洲成人免费av| 精品国产乱码久久久久久闺蜜| 久久精品99久久久| 日韩码欧中文字| 欧美三级视频在线| 日韩电影在线观看电影| 欧美精品一区二区三区蜜桃视频| 成人性色生活片| 日韩avvvv在线播放| 国产精品久久看| 欧美亚一区二区| 国产精品自拍在线| 一区二区成人在线| 久久日韩精品一区二区五区| 国产成人精品www牛牛影视| 一区二区欧美精品| 欧美激情一区在线| 欧美一区二区视频免费观看| 成人高清伦理免费影院在线观看| 日韩写真欧美这视频| 色屁屁一区二区| 97精品久久久久中文字幕| 激情亚洲综合在线| 午夜婷婷国产麻豆精品| 一区二区成人在线| 国产精品久久久久久久久久久免费看 | 久久97超碰色| 日本不卡一二三区黄网| 亚洲一区二区不卡免费| 自拍偷拍亚洲欧美日韩| 久久久不卡网国产精品一区| 欧美变态口味重另类| 日韩色在线观看| 精品欧美乱码久久久久久| 91精品国产全国免费观看| 色网站国产精品| 欧美日韩免费在线视频| 欧美美女黄视频| 欧美成人a∨高清免费观看| 日韩一级免费观看| 精品久久久三级丝袜| 久久精品一区二区三区不卡| 中文字幕不卡在线| 亚洲精品一区二区三区香蕉 | 久久精子c满五个校花| 日韩三级免费观看| 欧美精品一区二区久久久| 久久综合九色综合久久久精品综合 | 欧美久久久久久久久久| 日韩欧美激情一区| 国产精品视频线看| 免费在线看一区| 91丨九色丨黑人外教| 欧美日韩精品免费| 久久丝袜美腿综合| 亚洲一区二区四区蜜桃| 成人一区二区三区视频在线观看| 97久久超碰国产精品| 欧美大片免费久久精品三p | 国产精品天天看| 蜜臀av一级做a爰片久久| 91视频观看视频| 国产亚洲精品bt天堂精选| 日韩国产精品久久久久久亚洲| 风间由美一区二区三区在线观看 | 老司机免费视频一区二区三区| 日本高清不卡一区| 亚洲欧洲精品一区二区三区不卡| 日韩高清不卡一区二区| 在线观看日韩电影| 国产精品久久久久一区二区三区 | 奇米一区二区三区av| 日本韩国欧美一区二区三区| 国产亚洲精品福利| 99视频在线精品| 国产亚洲福利社区一区| 国产成人综合在线| 国产亚洲成年网址在线观看| 国产精品中文字幕日韩精品 | 欧美精品一区二区蜜臀亚洲| 精品综合久久久久久8888| 日韩女优av电影在线观看| 日韩精品成人一区二区三区| 91精品视频网| av一区二区三区在线| 亚洲综合无码一区二区| 777奇米成人网| 久久不见久久见免费视频7| 2023国产一二三区日本精品2022| 国产成人在线影院| 亚洲午夜成aⅴ人片| 精品久久免费看| 91在线国产观看| 性感美女极品91精品| 精品国产伦一区二区三区观看方式| 国产夫妻精品视频| 亚洲午夜免费视频| 精品久久久久久最新网址| 99久久er热在这里只有精品66| 亚洲成av人**亚洲成av**| 久久精品免视看| 欧美一区二区三区四区在线观看 | 亚洲成人在线网站| 中文字幕精品一区| 欧美va亚洲va在线观看蝴蝶网| 91色九色蝌蚪| 91小宝寻花一区二区三区| 国产精一区二区三区| 蜜桃视频一区二区三区在线观看| 亚洲影院在线观看| 亚洲色图视频网站| 中文字幕免费不卡在线| 久久综合九色综合欧美就去吻| 91精品国产福利在线观看| 99久久精品国产一区二区三区| 丁香六月综合激情| 福利一区在线观看| 成人亚洲精品久久久久软件| 久久精品国产99| 国产九色精品成人porny | 国内外成人在线视频| 国产成人超碰人人澡人人澡| 国产麻豆一精品一av一免费|