| | |
| | | import java.io.InputStream;
|
| | | import java.io.InputStreamReader;
|
| | | import java.net.InetAddress;
|
| | | import java.net.URL;
|
| | | import java.net.URLConnection;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.LinkedHashMap;
|
| | |
| | | ftpClient.connect(ip, port);
|
| | | ftpClient.login(userName, userPwd);
|
| | | ftpClient.changeWorkingDirectory(path);
|
| | | //ftpClient.enterRemotePassiveMode();
|
| | | //ftpClient.enterLocalPassiveMode();
|
| | | ftpClient.enterLocalPassiveMode();
|
| | | //ftpClient.enterLocalActiveMode();
|
| | | //ftpClient.enterRemoteActiveMode(InetAddress.getByName(ip), port);
|
| | |
|
| | |
|
| | | System.out.println("==================================================1");
|
| | | InputStream ins = ftpClient.retrieveFileStream(fileName);
|
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(ins,"utf-8"));
|
| | | String line;
|
| | |
| | | ftpClient.logout();
|
| | | ftpClient.disconnect();
|
| | | }
|
| | | System.out.println("==================================================2");
|
| | | System.out.println(content);
|
| | |
|
| | | // String urlStr = "http://www.7drlb.com/apps/Version.xml";
|
| | | // URL realUrl = new URL(urlStr);
|
| | | // URLConnection connection = realUrl.openConnection();
|
| | | // connection.connect();
|
| | | // StringBuffer result = new StringBuffer();
|
| | | // BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
|
| | | // String line;
|
| | | // while ((line = in.readLine()) != null) {
|
| | | // result.append(line);
|
| | | // }
|
| | | // String content = result.toString();
|
| | |
|
| | | SAXReader saxReader = new SAXReader();
|
| | | Document document = saxReader.read(new InputSource(new ByteArrayInputStream(content.getBytes("utf-8"))));
|