|  |  |  | 
|---|
|  |  |  | //        FTPClient ftpClient = new FTPClient(); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | //            ftpClient.connect(ip, port); | 
|---|
|  |  |  | //            ftpClient.login(userName, userPwd); | 
|---|
|  |  |  | //            ftpClient.changeWorkingDirectory(path); | 
|---|
|  |  |  | //            //ftpClient.enterRemotePassiveMode(); | 
|---|
|  |  |  | //            //ftpClient.enterLocalPassiveMode(); | 
|---|
|  |  |  | //            ftpClient.enterLocalActiveMode(); | 
|---|
|  |  |  | //            //ftpClient.enterRemoteActiveMode(InetAddress.getByName(ip), port); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //            InputStream ins = ftpClient.retrieveFileStream(fileName); | 
|---|
|  |  |  | //            BufferedReader reader = new BufferedReader(new InputStreamReader(ins,"utf-8")); | 
|---|
|  |  |  | //            String line; | 
|---|
|  |  |  | //            StringBuilder builder = new StringBuilder(); | 
|---|
|  |  |  | //            while ((line = reader.readLine()) != null) { | 
|---|
|  |  |  | //                builder.append(line); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //            reader.close(); | 
|---|
|  |  |  | //            if (ins != null) { | 
|---|
|  |  |  | //                ins.close(); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //            ftpClient.getReply(); | 
|---|
|  |  |  | //            String content = builder.toString(); | 
|---|
|  |  |  | //            if(ftpClient.isConnected()) { | 
|---|
|  |  |  | //                ftpClient.logout(); | 
|---|
|  |  |  | //                ftpClient.disconnect(); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | ////            ftpClient.login(userName, userPwd); | 
|---|
|  |  |  | ////            ftpClient.changeWorkingDirectory(path); | 
|---|
|  |  |  | ////            //ftpClient.enterRemotePassiveMode(); | 
|---|
|  |  |  | ////            //ftpClient.enterLocalPassiveMode(); | 
|---|
|  |  |  | ////            ftpClient.enterLocalActiveMode(); | 
|---|
|  |  |  | ////            //ftpClient.enterRemoteActiveMode(InetAddress.getByName(ip), port); | 
|---|
|  |  |  | //// | 
|---|
|  |  |  | ////            InputStream ins = ftpClient.retrieveFileStream(fileName); | 
|---|
|  |  |  | ////            BufferedReader reader = new BufferedReader(new InputStreamReader(ins,"utf-8")); | 
|---|
|  |  |  | ////            String line; | 
|---|
|  |  |  | ////            StringBuilder builder = new StringBuilder(); | 
|---|
|  |  |  | ////            while ((line = reader.readLine()) != null) { | 
|---|
|  |  |  | ////                builder.append(line); | 
|---|
|  |  |  | ////            } | 
|---|
|  |  |  | ////            reader.close(); | 
|---|
|  |  |  | ////            if (ins != null) { | 
|---|
|  |  |  | ////                ins.close(); | 
|---|
|  |  |  | ////            } | 
|---|
|  |  |  | ////            ftpClient.getReply(); | 
|---|
|  |  |  | ////            String content = builder.toString(); | 
|---|
|  |  |  | ////            if(ftpClient.isConnected()) { | 
|---|
|  |  |  | ////                ftpClient.logout(); | 
|---|
|  |  |  | ////                ftpClient.disconnect(); | 
|---|
|  |  |  | ////            } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | URL realUrl = new URL(urlStr); | 
|---|
|  |  |  | URLConnection connection = realUrl.openConnection(); | 
|---|
|  |  |  | connection.connect(); | 
|---|
|  |  |  | StringBuffer result = new StringBuffer(); | 
|---|
|  |  |  | BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); | 
|---|
|  |  |  | BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8")); | 
|---|
|  |  |  | String line; | 
|---|
|  |  |  | while ((line = in.readLine()) != null) { | 
|---|
|  |  |  | result.append(line); | 
|---|