Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- String ftpUrl = "ftp:////%s:%s@%s//%s;type=a";
- String host = "37.187.139.123";
- String user = "joe.shuff@btinternet.com.2995";
- String pass = "pass";
- String dirPath = "eula.txt";
- ftpUrl = String.format(ftpUrl, user, pass, host, dirPath);
- System.out.println("URL: " + ftpUrl);
- StringSelection selection = new StringSelection(ftpUrl);
- Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
- clipboard.setContents(selection, selection);
- try {
- URL url = new URL(ftpUrl);
- URLConnection conn = url.openConnection();
- InputStream inputStream = conn.getInputStream();
- BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
- String line = null;
- System.out.println("--- START ---");
- while ((line = reader.readLine()) != null) {
- System.out.println(line);
- }
- System.out.println("--- END ---");
- inputStream.close();
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement